Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[service-bus] Typescript samples are missing types for 'ws' and aren't building the samples/advanced folder #15666

Closed
richardpark-msft opened this issue Jun 10, 2021 · 0 comments · Fixed by #16233 or #16238
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Service Bus
Milestone

Comments

@richardpark-msft
Copy link
Member

richardpark-msft commented Jun 10, 2021

Looks like the type definitions for 'ws' aren't included in the samples. This probably needs to be added as a 'dev' dependency for the main service-bus package to show up properly.

src/useProxy.ts:10:23 - error TS7016: Could not find a declaration file for module 'ws'. 'C:/users/ripark/dev/temp/samptest1/typescript/node_modules/ws/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/ws if it exists or add a new declaration (.d.ts) file containing declare module 'ws';

10 import WebSocket from "ws";
~~~~

An error caused if you're just npm install'ing with the samples.

@richardpark-msft richardpark-msft added Client This issue points to a problem in the data-plane of the library. Service Bus labels Jun 10, 2021
@richardpark-msft richardpark-msft added this to the [2021] July milestone Jun 10, 2021
@richardpark-msft richardpark-msft self-assigned this Jun 10, 2021
@richardpark-msft richardpark-msft changed the title [service-bus] Missing type definitions for 'ws' samples [service-bus] Typescript samples are missing types for 'ws' and aren't building the samples/advanced folder Jun 10, 2021
@ghost ghost closed this as completed in #16233 Jul 6, 2021
ghost pushed a commit that referenced this issue Jul 6, 2021
Needed to allow the dev-tool to fix #15666.

This change updates the `dev-tool samples publish` command so that it pulls in any `@types/*` packages that are in the SDK's package.json that are associated with a runtime package.

### Service Bus Example:
__service-bus/package.json__
```json
{
  "dependencies": {
    "@azure/abort-controller": "^1.0.0",
    "@azure/core-amqp": "^3.0.0",
    "@azure/core-asynciterator-polyfill": "^1.0.0",
    "@azure/core-http": "^2.0.0",
    "@azure/core-tracing": "1.0.0-preview.12",
    "@azure/core-paging": "^1.1.1",
    "@azure/core-auth": "^1.3.0",
    "@azure/logger": "^1.0.0",
    "@types/is-buffer": "^2.0.0",
    "@types/long": "^4.0.0",
    "buffer": "^5.2.1",
    "is-buffer": "^2.0.3",
    "jssha": "^3.1.0",
    "long": "^4.0.0",
    "process": "^0.11.10",
    "tslib": "^2.2.0",
    "rhea-promise": "^2.1.0"
  },
  "devDependencies": {
    "@azure/dev-tool": "^1.0.0",
    "@azure/eslint-plugin-azure-sdk": "^3.0.0",
    "@azure/identity": "2.0.0-beta.4",
    "@azure/test-utils-perfstress": "^1.0.0",
    "@microsoft/api-extractor": "7.7.11",
    "@rollup/plugin-commonjs": "11.0.2",
    "@rollup/plugin-inject": "^4.0.0",
    "@rollup/plugin-json": "^4.0.0",
    "@rollup/plugin-multi-entry": "^3.0.0",
    "@rollup/plugin-node-resolve": "^8.0.0",
    "@rollup/plugin-replace": "^2.2.0",
    "@types/chai": "^4.1.6",
    "@types/chai-as-promised": "^7.1.0",
    "@types/debug": "^4.1.4",
    "@types/glob": "^7.1.1",
    "@types/mocha": "^7.0.2",
    "@types/node": "^12.0.0",
    "@types/ws": "^7.2.4",
    "assert": "^1.4.1",
    "chai": "^4.2.0",
    "chai-as-promised": "^7.1.1",
    "chai-exclude": "^2.0.2",
    "cross-env": "^7.0.2",
    "debug": "^4.1.1",
    "delay": "^4.2.0",
    "dotenv": "^8.2.0",
    "downlevel-dts": "~0.4.0",
    "eslint": "^7.15.0",
    "esm": "^3.2.18",
    "glob": "^7.1.2",
    "https-proxy-agent": "^5.0.0",
    "karma": "^6.2.0",
    "karma-chrome-launcher": "^3.0.0",
    "karma-coverage": "^2.0.0",
    "karma-edge-launcher": "^0.4.2",
    "karma-env-preprocessor": "^0.1.1",
    "karma-firefox-launcher": "^1.1.0",
    "karma-ie-launcher": "^1.0.0",
    "karma-junit-reporter": "^2.0.1",
    "karma-mocha": "^2.0.1",
    "karma-mocha-reporter": "^2.2.5",
    "karma-sourcemap-loader": "^0.3.8",
    "mocha": "^7.1.1",
    "mocha-junit-reporter": "^1.18.0",
    "moment": "^2.24.0",
    "nyc": "^14.0.0",
    "prettier": "^1.16.4",
    "promise": "^8.0.3",
    "puppeteer": "^3.3.0",
    "rimraf": "^3.0.0",
    "rollup": "^1.16.3",
    "rollup-plugin-shim": "^1.0.0",
    "rollup-plugin-sourcemaps": "^0.4.2",
    "rollup-plugin-terser": "^5.1.1",
    "ts-node": "^9.0.0",
    "typescript": "~4.2.0",
    "ws": "^7.1.1",
    "sinon": "^9.0.2",
    "@types/sinon": "^9.0.4",
    "events": "^3.0.0",
    "typedoc": "0.15.2"
  }
}
```

__Generated TS samples package.json__
```json
{
  "dependencies": {
    "@azure/service-bus": "latest",
    "dotenv": "latest",
    "ws": "^7.1.1",
    "https-proxy-agent": "^5.0.0",
    "@azure/identity": "^1.1.0",
    "@azure/abort-controller": "^1.0.0"
  },
  "devDependencies": {
    "@types/ws": "^7.2.4",
    "typescript": "~4.2.0",
    "rimraf": "latest"
  }
}
```

In the service-bus example, `@types/ws` is added as a devDependency in the TypeScript samples package.json because one of the samples depends on `ws`, and `@types/ws` is defined in the `devDependencies` of the `@azure/service-bus` package.json.
ghost pushed a commit that referenced this issue Jul 6, 2021
Fixes #15666

It also turns out the samples depended on the `next` tag for service-bus, which is no longer published on NPM, so this update fixes that issue by depending on the `latest` tag.
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. Service Bus
Projects
None yet
2 participants