Title: Strange warning with 'instanceof' · Issue #18276 · microsoft/TypeScript · GitHub
Open Graph Title: Strange warning with 'instanceof' · Issue #18276 · microsoft/TypeScript
X Title: Strange warning with 'instanceof' · Issue #18276 · microsoft/TypeScript
Description: TypeScipt 2.5.2 Sorry, I wasn't able to extract a simplified example: git clone https://github.com/Microsoft/vscode-css-languageservice.git cd vscode-css-languageservice git checkout 73f8707 npm install npm run compile src/services/cssCo...
Open Graph Description: TypeScipt 2.5.2 Sorry, I wasn't able to extract a simplified example: git clone https://github.com/Microsoft/vscode-css-languageservice.git cd vscode-css-languageservice git checkout 73f8707 npm in...
X Description: TypeScipt 2.5.2 Sorry, I wasn't able to extract a simplified example: git clone https://github.com/Microsoft/vscode-css-languageservice.git cd vscode-css-languageservice git checkout 73f8707 np...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/18276
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Strange warning with 'instanceof'","articleBody":"TypeScipt 2.5.2\r\n\r\nSorry, I wasn't able to extract a simplified example:\r\n\r\n- `git clone https://github.com/Microsoft/vscode-css-languageservice.git`\r\n- `cd vscode-css-languageservice` \r\n- `git checkout 73f8707`\r\n- `npm install`\r\n- `npm run compile`\r\n\r\n`src/services/cssCompletion.ts(804,47) error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.`\r\n[link to cssCompletion.ts: 804](https://github.com/Microsoft/vscode-css-languageservice/blob/73f8707a411150c49e2b6ca44ecc1d06d263c005/src/services/cssCompletion.ts#L804)\r\n\r\n\r\n\r\nIt's a new error, not reported by a previous version of typescript.\r\nBoth `nodes.HexColorValue`([link](https://github.com/Microsoft/vscode-css-languageservice/blob/73f8707a411150c49e2b6ca44ecc1d06d263c005/src/parser/cssNodes.ts#L1205)) and `nodes.Function`([link](https://github.com/Microsoft/vscode-css-languageservice/blob/73f8707a411150c49e2b6ca44ecc1d06d263c005/src/parser/cssNodes.ts#L704)) are classes that extend base class `nodes.Node`([link](https://github.com/Microsoft/vscode-css-languageservice/blob/73f8707a411150c49e2b6ca44ecc1d06d263c005/src/parser/cssNodes.ts#L146)). The way I see it, the instanceof test is valid code to test the runtime types of the object.\r\n\r\nAdding a brand field `_hexColorValue : void;` to `nodes.HexColorValue` fixes the issue, so maybe this is related to #12083.\r\nAt the very least the message should be improved, but IMO the error is invalid.","author":{"url":"https://github.com/aeschli","@type":"Person","name":"aeschli"},"datePublished":"2017-09-06T16:20:29Z","url":"https://github.com/microsoft/TypeScript/issues/18276"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:26eb914d-03b5-cef2-47ee-4df5078c434f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 855A:1D20B7:7DE25:9DEFC:6B00F537 |
| html-safe-nonce | 75a04f525f4483e4bdafa53a14b4fd4842b8c4723512fc50f0a236a110275fbb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTVBOjFEMjBCNzo3REUyNTo5REVGQzo2QjAwRjUzNyIsInZpc2l0b3JfaWQiOiI1NjI2NzA0OTY4MjkyNTYyMjMxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 120cf222bf51a3a232c977b6dc723a953fea4d4a43006e07c1cd50c711cd9d26 |
| hovercard-subject-tag | issue:255663698 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/18276/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ebcc295f6c1b11f89458e93a6e2e05e37262db1b103c698effe89eadf542cc92/microsoft/TypeScript/issues/18276 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ebcc295f6c1b11f89458e93a6e2e05e37262db1b103c698effe89eadf542cc92/microsoft/TypeScript/issues/18276 |
| og:image:alt | TypeScipt 2.5.2 Sorry, I wasn't able to extract a simplified example: git clone https://github.com/Microsoft/vscode-css-languageservice.git cd vscode-css-languageservice git checkout 73f8707 npm in... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | aeschli |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width