Repository: TypeScript
Issue: isArray type guards still causing issues in latest nightly build 
Labels: Needs Investigation,Rescheduled

# 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. 

Here's an example from [this file](https://github.com/microsoft/vscode/blob/907050807608bfe4705a426e819815e97f2429be/src/vs/workbench/api/common/extHostTypeConverters.ts#L1275)

The type of `DocumentSelector` is `string | vscode.DocumentFilter | readonly (string | vscode.DocumentFilter)[]`

```ts
	export function from(selector: vscode.DocumentSelector | undefined): languageSelector.LanguageSelector | undefined {
		if (!selector) {
			return undefined;
		} else if (Array.isArray(selector)) {
			return <languageSelector.LanguageSelector>selector.map(from);
		} else if (typeof selector === 'string') {
			return selector;
		} else {
			return <languageSelector.LanguageFilter>{
				language: selector.language,
				scheme: selector.scheme,
				pattern: typeof selector.pattern === 'undefined' ? undefined : GlobPattern.from(selector.pattern),
				exclusive: selector.exclusive
			};
		}
	}
```


The error in the `else` block on the line `language: selector.language`:

```
[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)[]'.
[watch-client    ]   Property 'language' does not exist on type 'readonly (string | DocumentFilter)[]'.
```

These errors did not show up with `typescript@4.2.0-dev.20201207`. 

Here are the other errors:

```
[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'.
[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'.
[watch-client    ]     Type 'undefined' is not assignable to type 'T'.
[watch-client    ]       'T' could be instantiated with an arbitrary type which could be unrelated to 'undefined'.
[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'.
[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'.
[watch-client    ]     Type 'undefined' is not assignable to type 'T'.
[watch-client    ]       'T' could be instantiated with an arbitrary type which could be unrelated to 'undefined'.
[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'.
[watch-client    ]   Property 'getActions' does not exist on type 'readonly IAction[]'.
[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)[]'.
[watch-client    ]   Property 'language' does not exist on type 'readonly (string | DocumentFilter)[]'.
[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)[]'.
[watch-client    ]   Property 'scheme' does not exist on type 'readonly (string | DocumentFilter)[]'.
[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)[]'.
[watch-client    ]   Property 'pattern' does not exist on type 'readonly (string | DocumentFilter)[]'.
[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)[]'.
[watch-client    ]   Property 'pattern' does not exist on type 'readonly (string | DocumentFilter)[]'.
[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)[]'.
[watch-client    ]   Property 'exclusive' does not exist on type 'readonly (string | DocumentFilter)[]'.
[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)[]'.
[watch-client    ]   Property 'scheme' does not exist on type 'readonly (string | DocumentFilter)[]'.
[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)[]'.
[watch-client    ]   Property 'exclusive' does not exist on type 'readonly (string | DocumentFilter)[]'.
[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)[]'.
[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)[]'.
[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)[]'.
[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)[]'.
[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)[]'.
[watch-client    ]   Property 'exclusive' does not exist on type 'readonly (string | LanguageFilter)[]'.
```


@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