Title: isArray type guards still causing issues in latest nightly build · Issue #42768 · microsoft/TypeScript · GitHub
Open Graph Title: isArray type guards still causing issues in latest nightly build · Issue #42768 · microsoft/TypeScript
X Title: isArray type guards still causing issues in latest nightly build · Issue #42768 · microsoft/TypeScript
Description: Bug Report 🔎 Search Terms isArray 🕗 Version & Regression Information Tested in 4.3.0-dev.20210211 which 💻 Code In the VS Code codebase, we are still seeing the isArray type guards causing problems with the latest TS 4.3 nightly build. He...
Open Graph Description: Bug Report 🔎 Search Terms isArray 🕗 Version & Regression Information Tested in 4.3.0-dev.20210211 which 💻 Code In the VS Code codebase, we are still seeing the isArray type guards causing problems ...
X Description: Bug Report 🔎 Search Terms isArray 🕗 Version & Regression Information Tested in 4.3.0-dev.20210211 which 💻 Code In the VS Code codebase, we are still seeing the isArray type guards causing probl...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/42768
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"isArray type guards still causing issues in latest nightly build ","articleBody":"# Bug Report\r\n\r\n### 🔎 Search Terms\r\n- isArray\r\n\r\n### 🕗 Version & Regression Information\r\n\r\nTested in 4.3.0-dev.20210211 which \r\n\r\n### 💻 Code\r\n\r\nIn the VS Code codebase, we are still seeing the `isArray` type guards causing problems with the latest TS 4.3 nightly build. \r\n\r\nHere's an example from [this file](https://github.com/microsoft/vscode/blob/907050807608bfe4705a426e819815e97f2429be/src/vs/workbench/api/common/extHostTypeConverters.ts#L1275)\r\n\r\nThe type of `DocumentSelector` is `string | vscode.DocumentFilter | readonly (string | vscode.DocumentFilter)[]`\r\n\r\n```ts\r\n\texport function from(selector: vscode.DocumentSelector | undefined): languageSelector.LanguageSelector | undefined {\r\n\t\tif (!selector) {\r\n\t\t\treturn undefined;\r\n\t\t} else if (Array.isArray(selector)) {\r\n\t\t\treturn \u003clanguageSelector.LanguageSelector>selector.map(from);\r\n\t\t} else if (typeof selector === 'string') {\r\n\t\t\treturn selector;\r\n\t\t} else {\r\n\t\t\treturn \u003clanguageSelector.LanguageFilter>{\r\n\t\t\t\tlanguage: selector.language,\r\n\t\t\t\tscheme: selector.scheme,\r\n\t\t\t\tpattern: typeof selector.pattern === 'undefined' ? undefined : GlobPattern.from(selector.pattern),\r\n\t\t\t\texclusive: selector.exclusive\r\n\t\t\t};\r\n\t\t}\r\n\t}\r\n```\r\n\r\n\r\nThe error in the `else` block on the line `language: selector.language`:\r\n\r\n```\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/workbench/api/common/extHostTypeConverters.ts(1284,24): Property 'language' does not exist on type 'DocumentFilter | readonly (string | DocumentFilter)[]'.\r\n[watch-client ] Property 'language' does not exist on type 'readonly (string | DocumentFilter)[]'.\r\n```\r\n\r\nThese errors did not show up with `typescript@4.2.0-dev.20201207`. \r\n\r\nHere are the other errors:\r\n\r\n```\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.ts(545,58): Argument of type 'ILocalization[] | IAuthenticationContribution[] | IDebugger[] | { [location: string]: IView[]; } | ISnippet[] | IConfiguration | ... 12 more ... | undefined' is not assignable to parameter of type 'T'.\r\n[watch-client ] 'T' could be instantiated with an arbitrary type which could be unrelated to 'ILocalization[] | IAuthenticationContribution[] | IDebugger[] | { [location: string]: IView[]; } | ISnippet[] | IConfiguration | ... 12 more ... | undefined'.\r\n[watch-client ] Type 'undefined' is not assignable to type 'T'.\r\n[watch-client ] 'T' could be instantiated with an arbitrary type which could be unrelated to 'undefined'.\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.ts(700,6): Type 'ILocalization[] | IAuthenticationContribution[] | IDebugger[] | { [location: string]: IView[]; } | ISnippet[] | IConfiguration | ... 12 more ... | undefined' is not assignable to type 'T'.\r\n[watch-client ] 'T' could be instantiated with an arbitrary type which could be unrelated to 'ILocalization[] | IAuthenticationContribution[] | IDebugger[] | { [location: string]: IView[]; } | ISnippet[] | IConfiguration | ... 12 more ... | undefined'.\r\n[watch-client ] Type 'undefined' is not assignable to type 'T'.\r\n[watch-client ] 'T' could be instantiated with an arbitrary type which could be unrelated to 'undefined'.\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/base/browser/ui/dropdown/dropdownActionViewItem.ts(175,99): Property 'getActions' does not exist on type 'readonly IAction[] | IActionProvider'.\r\n[watch-client ] Property 'getActions' does not exist on type 'readonly IAction[]'.\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/workbench/api/common/extHostTypeConverters.ts(1284,24): Property 'language' does not exist on type 'DocumentFilter | readonly (string | DocumentFilter)[]'.\r\n[watch-client ] Property 'language' does not exist on type 'readonly (string | DocumentFilter)[]'.\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/workbench/api/common/extHostTypeConverters.ts(1285,22): Property 'scheme' does not exist on type 'DocumentFilter | readonly (string | DocumentFilter)[]'.\r\n[watch-client ] Property 'scheme' does not exist on type 'readonly (string | DocumentFilter)[]'.\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/workbench/api/common/extHostTypeConverters.ts(1286,30): Property 'pattern' does not exist on type 'DocumentFilter | readonly (string | DocumentFilter)[]'.\r\n[watch-client ] Property 'pattern' does not exist on type 'readonly (string | DocumentFilter)[]'.\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/workbench/api/common/extHostTypeConverters.ts(1286,94): Property 'pattern' does not exist on type 'DocumentFilter | readonly (string | DocumentFilter)[]'.\r\n[watch-client ] Property 'pattern' does not exist on type 'readonly (string | DocumentFilter)[]'.\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/workbench/api/common/extHostTypeConverters.ts(1287,25): Property 'exclusive' does not exist on type 'DocumentFilter | readonly (string | DocumentFilter)[]'.\r\n[watch-client ] Property 'exclusive' does not exist on type 'readonly (string | DocumentFilter)[]'.\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/workbench/api/common/extHost.api.impl.ts(201,26): Property 'scheme' does not exist on type 'DocumentFilter | readonly (string | DocumentFilter)[]'.\r\n[watch-client ] Property 'scheme' does not exist on type 'readonly (string | DocumentFilter)[]'.\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/workbench/api/common/extHost.api.impl.ts(204,58): Property 'exclusive' does not exist on type 'DocumentFilter | readonly (string | DocumentFilter)[]'.\r\n[watch-client ] Property 'exclusive' does not exist on type 'readonly (string | DocumentFilter)[]'.\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/editor/common/modes/languageSelector.ts(58,11): Property 'language' does not exist on type 'LanguageFilter | readonly (string | LanguageFilter)[]'.\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/editor/common/modes/languageSelector.ts(58,21): Property 'pattern' does not exist on type 'LanguageFilter | readonly (string | LanguageFilter)[]'.\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/editor/common/modes/languageSelector.ts(58,30): Property 'scheme' does not exist on type 'LanguageFilter | readonly (string | LanguageFilter)[]'.\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/editor/common/modes/languageSelector.ts(58,38): Property 'hasAccessToAllModels' does not exist on type 'LanguageFilter | readonly (string | LanguageFilter)[]'.\r\n[watch-client ] [13:45:27] Error: /Users/matb/projects/vscode/src/vs/editor/common/modes/languageFeatureRegistry.ts(28,21): Property 'exclusive' does not exist on type 'LanguageFilter | readonly (string | LanguageFilter)[]'.\r\n[watch-client ] Property 'exclusive' does not exist on type 'readonly (string | LanguageFilter)[]'.\r\n```\r\n\r\n\r\n@orta @RyanCavanaugh I believed that https://github.com/microsoft/TypeScript/pull/41851 was supposed to fix these issues. Can you please take a look at our errors and me know if we need to change anything on the VS Code side or if these are unexpected errors","author":{"url":"https://github.com/mjbvz","@type":"Person","name":"mjbvz"},"datePublished":"2021-02-11T21:52:34Z","url":"https://github.com/microsoft/TypeScript/issues/42768"}
| 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:78b604a5-6cf4-a9ce-28db-e7facf0fa2b4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E20C:38C5CF:333934E:40F00F6:6B01B9B3 |
| html-safe-nonce | 6c809ed55209b565f4758a43fbeb3fda112fc1933dc35dee57e0cde2d5e94a07 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjBDOjM4QzVDRjozMzM5MzRFOjQwRjAwRjY6NkIwMUI5QjMiLCJ2aXNpdG9yX2lkIjoiNzMzNzg4MzIxMjQ3NzIxNzIwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 91ba933973edd49fce88a3c26d4e08a83b194ae5e0d8045cb94df76cc6dbfff1 |
| hovercard-subject-tag | issue:806772473 |
| 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/42768/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b09f95cab50f4d0e42c41d56489338e31c40d2c6d32a4c44668c91f09515fbf0/microsoft/TypeScript/issues/42768 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b09f95cab50f4d0e42c41d56489338e31c40d2c6d32a4c44668c91f09515fbf0/microsoft/TypeScript/issues/42768 |
| og:image:alt | Bug Report 🔎 Search Terms isArray 🕗 Version & Regression Information Tested in 4.3.0-dev.20210211 which 💻 Code In the VS Code codebase, we are still seeing the isArray type guards causing problems ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mjbvz |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width