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

VS Code codebase compile errors with 3.9.0-dev.20200324 #37556

Closed
mjbvz opened this issue Mar 24, 2020 · 7 comments · Fixed by #37610
Closed

VS Code codebase compile errors with 3.9.0-dev.20200324 #37556

mjbvz opened this issue Mar 24, 2020 · 7 comments · Fixed by #37610

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Mar 24, 2020

TypeScript Version: 3.9.0-dev.20200324

Repro

  1. Try using 3.9.0-dev.20200324 to build VS Code

Problem
I see ~30 errors (after fixing a few simple ones). Many of these are related to awaited. I'll start splitting out individual issues when I can create small repos

[14:16:40] Error: /Users/matb/projects/vscode/src/vs/workbench/services/search/node/rawSearchService.ts(382,3): Type '(Anonymous class)' is not assignable to type 'CancelablePromise<C>'.
  Types of property 'then' are incompatible.
    Type '<TResult1 = C, TResult2 = never>(resolve?: ((value: C) => TResult1 | Promise<TResult1>) | null | undefined, reject?: ((reason: any) => TResult2 | Promise<TResult2>) | null | undefined) => Promise<...>' is not assignable to type '<TResult1 = C, TResult2 = never>(onfulfilled?: ((value: awaited C) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => Promise<...>'.
      Types of parameters 'resolve' and 'onfulfilled' are incompatible.
        Types of parameters 'value' and 'value' are incompatible.
          Type 'C' is not assignable to type 'awaited C'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/workbench/services/search/node/rawSearchService.ts(387,4): Property 'then' in type '(Anonymous class)' is not assignable to the same property in base type 'CancelablePromise<C>'.
  Type '<TResult1 = C, TResult2 = never>(resolve?: ((value: C) => TResult1 | Promise<TResult1>) | null | undefined, reject?: ((reason: any) => TResult2 | Promise<TResult2>) | null | undefined) => Promise<...>' is not assignable to type '<TResult1 = C, TResult2 = never>(onfulfilled?: ((value: awaited C) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => Promise<...>'.
    Types of parameters 'resolve' and 'onfulfilled' are incompatible.
      Types of parameters 'value' and 'value' are incompatible.
        Type 'C' is not assignable to type 'awaited C'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/workbench/services/search/node/rawSearchService.ts(388,25): Argument of type '((value: C) => TResult1 | Promise<TResult1>) | null | undefined' is not assignable to parameter of type '((value: awaited C) => TResult1 | awaited TResult1 | PromiseLike<TResult1 | awaited TResult1>) | null | undefined'.
  Type '(value: C) => TResult1 | Promise<TResult1>' is not assignable to type '(value: awaited C) => TResult1 | awaited TResult1 | PromiseLike<TResult1 | awaited TResult1>'.
    Types of parameters 'value' and 'value' are incompatible.
      Type 'awaited C' is not assignable to type 'C'.
        'C' could be instantiated with an arbitrary type which could be unrelated to 'awaited C'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/workbench/services/history/browser/history.ts(342,49): Argument of type '() => boolean' is not assignable to parameter of type '() => void | PromiseLike<void>'.
  Type 'boolean' is not assignable to type 'void | PromiseLike<void>'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/workbench/contrib/search/common/searchModel.ts(609,21): Type 'FileMatch | FileMatch[]' must have a '[Symbol.iterator]()' method that returns an iterator.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/base/browser/ui/list/listPaging.ts(58,53): Argument of type 'awaited TElement' is not assignable to parameter of type 'TElement'.
  'TElement' could be instantiated with an arbitrary type which could be unrelated to 'awaited TElement'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/platform/extensionManagement/node/extensionManagementService.ts(89,42): Type '{ [x: string]: any; }' must have a '[Symbol.iterator]()' method that returns an iterator.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/workbench/api/common/extHostTreeViews.ts(336,43): Argument of type 'awaited T' is not assignable to parameter of type 'T'.
  'T' could be instantiated with an arbitrary type which could be unrelated to 'awaited T'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/workbench/api/common/extHostTreeViews.ts(337,43): Argument of type 'awaited T' is not assignable to parameter of type 'T'.
  'T' could be instantiated with an arbitrary type which could be unrelated to 'awaited T'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/workbench/api/common/extHostCommands.ts(230,67): Argument of type '<R>(...args: any[]) => Promise<R>' is not assignable to parameter of type '<T>(...args: any[]) => T | Thenable<T>'.
  Type 'Promise<T>' is not assignable to type 'T | Thenable<T>'.
    Type 'Promise<T>' is not assignable to type 'Thenable<T>'.
      Types of property 'then' are incompatible.
        Type '<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: awaited T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => Promise<...>' is not assignable to type '{ <TResult>(onfulfilled?: ((value: T) => TResult | Thenable<TResult>) | undefined, onrejected?: ((reason: any) => TResult | Thenable<TResult>) | undefined): Thenable<...>; <TResult>(onfulfilled?: ((value: T) => TResult | Thenable<...>) | undefined, onrejected?: ((reason: any) => void) | undefined): Thenable<...>; <T...'.
          Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
            Type '((value: T) => any) | undefined' is not assignable to type '((value: awaited T) => any) | null | undefined'.
              Type '(value: T) => any' is not assignable to type '(value: awaited T) => any'.
                Types of parameters 'value' and 'value' are incompatible.
                  Type 'awaited T' is not assignable to type 'T'.
                    'T' could be instantiated with an arbitrary type which could be unrelated to 'awaited T'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/workbench/api/common/extHost.api.impl.ts(246,5): Type 'Promise<T>' is not assignable to type 'Thenable<T>'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/workbench/api/common/extHost.api.impl.ts(1076,3): Type 'Promise<awaited T>' is not assignable to type 'Thenable<T>'.
  Types of property 'then' are incompatible.
    Type '<TResult1 = awaited T, TResult2 = never>(onfulfilled?: ((value: awaited T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => Promise<...>' is not assignable to type '{ <TResult>(onfulfilled?: ((value: T) => TResult | Thenable<TResult>) | undefined, onrejected?: ((reason: any) => TResult | Thenable<TResult>) | undefined): Thenable<...>; <TResult>(onfulfilled?: ((value: T) => TResult | Thenable<...>) | undefined, onrejected?: ((reason: any) => void) | undefined): Thenable<...>; <T...'.
      Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
        Type '((value: T) => any) | undefined' is not assignable to type '((value: awaited T) => any) | null | undefined'.
          Type '(value: T) => any' is not assignable to type '(value: awaited T) => any'.
            Types of parameters 'value' and 'value' are incompatible.
              Type 'awaited T' is not assignable to type 'T'.
                'T' could be instantiated with an arbitrary type which could be unrelated to 'awaited T'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/editor/contrib/hover/hoverOperation.ts(104,39): Argument of type '(asyncResult: Result) => void' is not assignable to parameter of type '(value: awaited Result) => void | PromiseLike<void>'.
  Types of parameters 'asyncResult' and 'value' are incompatible.
    Type 'awaited Result' is not assignable to type 'Result'.
      'Result' could be instantiated with an arbitrary type which could be unrelated to 'awaited Result'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/base/common/async.ts(37,9): Conversion of type '(Anonymous class)' to type 'CancelablePromise<T>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Property '[Symbol.toStringTag]' is missing in type '(Anonymous class)' but required in type 'CancelablePromise<T>'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/base/common/async.ts(42,24): Argument of type '((value: T) => TResult1 | Promise<TResult1>) | null | undefined' is not assignable to parameter of type '((value: awaited T) => TResult1 | awaited TResult1 | PromiseLike<TResult1 | awaited TResult1>) | null | undefined'.
  Type '(value: T) => TResult1 | Promise<TResult1>' is not assignable to type '(value: awaited T) => TResult1 | awaited TResult1 | PromiseLike<TResult1 | awaited TResult1>'.
    Types of parameters 'value' and 'value' are incompatible.
      Type 'awaited T' is not assignable to type 'T'.
        'T' could be instantiated with an arbitrary type which could be unrelated to 'awaited T'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/base/common/async.ts(79,12): Argument of type 'T | Thenable<T>' is not assignable to parameter of type 'T | awaited T | PromiseLike<T> | undefined'.
  Type 'Thenable<T>' is not assignable to type 'T | awaited T | PromiseLike<T> | undefined'.
    Type 'Thenable<T>' is not assignable to type 'PromiseLike<T>'.
      Types of property 'then' are incompatible.
        Type '{ <TResult>(onfulfilled?: ((value: T) => TResult | Thenable<TResult>) | undefined, onrejected?: ((reason: any) => TResult | Thenable<TResult>) | undefined): Thenable<...>; <TResult>(onfulfilled?: ((value: T) => TResult | Thenable<...>) | undefined, onrejected?: ((reason: any) => void) | undefined): Thenable<...>; <T...' is not assignable to type '<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: awaited T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => PromiseLike<...>'.
          Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
            Type '((value: awaited T) => any) | null | undefined' is not assignable to type '((value: T) => any) | undefined'.
              Type 'null' is not assignable to type '((value: T) => any) | undefined'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/base/common/async.ts(403,19): Argument of type 'awaited T' is not assignable to parameter of type 'T'.
  'T' could be instantiated with an arbitrary type which could be unrelated to 'awaited T'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/base/common/async.ts(463,17): Argument of type '(value?: T | Promise<T> | undefined) => void' is not assignable to parameter of type '(value: awaited T) => void | PromiseLike<void>'.
  Types of parameters 'value' and 'value' are incompatible.
    Type 'awaited T' is not assignable to type 'T | Promise<T> | undefined'.
      Type 'awaited T' is not assignable to type 'Promise<T>'.
[14:16:40] Error: /Users/matb/projects/vscode/src/vs/workbench/workbench.web.api.ts(249,25): Type 'readonly ICommand[] | undefined' must have a '[Symbol.iterator]()' method that returns an iterator.
[14:16:40] Error: /Users/matb/projects/vscode/extensions/merge-conflict/src/delayer.ts(34,5): Type '(value?: T | awaited T | PromiseLike<T> | undefined) => void' is not assignable to type '(value?: T | Thenable<T> | undefined) => void'.
  Types of parameters 'value' and 'value' are incompatible.
    Type 'T | Thenable<T> | undefined' is not assignable to type 'T | awaited T | PromiseLike<T> | undefined'.
      Type 'Thenable<T>' is not assignable to type 'T | awaited T | PromiseLike<T> | undefined'.
        Type 'Thenable<T>' is not assignable to type 'PromiseLike<T>'.
          Types of property 'then' are incompatible.
            Type '{ <TResult>(onfulfilled?: ((value: T) => TResult | Thenable<TResult>) | undefined, onrejected?: ((reason: any) => TResult | Thenable<TResult>) | undefined): Thenable<...>; <TResult>(onfulfilled?: ((value: T) => TResult | Thenable<...>) | undefined, onrejected?: ((reason: any) => void) | undefined): Thenable<...>; }' is not assignable to type '<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: awaited T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => PromiseLike<...>'.
              Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
                Type '((value: awaited T) => any) | null | undefined' is not assignable to type '((value: T) => any) | undefined'.
                  Type 'null' is not assignable to type '((value: T) => any) | undefined'.
[14:16:40] Error: /Users/matb/projects/vscode/extensions/github-authentication/src/common/utils.ts(64,3): Argument of type '(result: U) => U' is not assignable to parameter of type '(value: awaited U) => U | PromiseLike<U>'.
  Types of parameters 'result' and 'value' are incompatible.
    Type 'awaited U' is not assignable to type 'U'.
      'U' could be instantiated with an arbitrary type which could be unrelated to 'awaited U'.
[14:16:40] Error: /Users/matb/projects/vscode/extensions/git/src/util.ts(390,17): Argument of type '(value?: T | Promise<T> | undefined) => void' is not assignable to parameter of type '(value: awaited T) => void | PromiseLike<void>'.
  Types of parameters 'value' and 'value' are incompatible.
    Type 'awaited T' is not assignable to type 'T | Promise<T> | undefined'.
      Type 'awaited T' is not assignable to type 'Promise<T>'.
[14:16:40] Error: /Users/matb/projects/vscode/extensions/git/src/commands.ts(2567,3): Type '(awaited T)[]' is not assignable to type 'T[]'.
  Type 'awaited T' is not assignable to type 'T'.
    'T' could be instantiated with an arbitrary type which could be unrelated to 'awaited T'.
[14:16:40] Error: /Users/matb/projects/vscode/extensions/typescript-language-features/src/utils/async.ts(34,5): Type '(value?: T | awaited T | PromiseLike<T> | undefined) => void' is not assignable to type '(value?: T | Thenable<T> | undefined) => void'.
  Types of parameters 'value' and 'value' are incompatible.
    Type 'T | Thenable<T> | undefined' is not assignable to type 'T | awaited T | PromiseLike<T> | undefined'.
      Type 'Thenable<T>' is not assignable to type 'T | awaited T | PromiseLike<T> | undefined'.
        Type 'Thenable<T>' is not assignable to type 'PromiseLike<T>'.
          Types of property 'then' are incompatible.
            Type '{ <TResult>(onfulfilled?: ((value: T) => TResult | Thenable<TResult>) | undefined, onrejected?: ((reason: any) => TResult | Thenable<TResult>) | undefined): Thenable<...>; <TResult>(onfulfilled?: ((value: T) => TResult | Thenable<...>) | undefined, onrejected?: ((reason: any) => void) | undefined): Thenable<...>; }' is not assignable to type '<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: awaited T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => PromiseLike<...>'.
              Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
                Type '((value: awaited T) => any) | null | undefined' is not assignable to type '((value: T) => any) | undefined'.
                  Type 'null' is not assignable to type '((value: T) => any) | undefined'.
[14:16:40] Error: /Users/matb/projects/vscode/extensions/php-language-features/src/features/utils/async.ts(69,29): Argument of type '(result: T) => void' is not assignable to parameter of type '(value: awaited T) => void | PromiseLike<void>'.
  Types of parameters 'result' and 'value' are incompatible.
    Type 'awaited T' is not assignable to type 'T'.
      'T' could be instantiated with an arbitrary type which could be unrelated to 'awaited T'.
[14:16:40] Error: /Users/matb/projects/vscode/extensions/php-language-features/src/features/utils/async.ts(125,5): Type '(value?: T | awaited T | PromiseLike<T> | undefined) => void' is not assignable to type '(value: T | Thenable<T> | undefined) => void'.
  Types of parameters 'value' and 'value' are incompatible.
    Type 'T | Thenable<T> | undefined' is not assignable to type 'T | awaited T | PromiseLike<T> | undefined'.
      Type 'Thenable<T>' is not assignable to type 'T | awaited T | PromiseLike<T> | undefined'.
        Type 'Thenable<T>' is not assignable to type 'PromiseLike<T>'.
          Types of property 'then' are incompatible.
            Type '{ <TResult>(onfulfilled?: ((value: T) => TResult | Thenable<TResult>) | undefined, onrejected?: ((reason: any) => TResult | Thenable<TResult>) | undefined): Thenable<...>; <TResult>(onfulfilled?: ((value: T) => TResult | Thenable<...>) | undefined, onrejected?: ((reason: any) => void) | undefined): Thenable<...>; }' is not assignable to type '<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: awaited T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => PromiseLike<...>'.
              Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
                Type '((value: awaited T) => any) | null | undefined' is not assignable to type '((value: T) => any) | undefined'.
                  Type 'null' is not assignable to type '((value: T) => any) | undefined'.
@mjbvz
Copy link
Contributor Author

mjbvz commented Mar 24, 2020

Looks like some of these are already tracked:

@rbuckton
Copy link
Member

This is due to the inclusion of the new awaited type in the 3.9 nightlies and beta. We're working through breaks currently to determine next steps. I am looking to make a change to PromiseLike shortly that will revert the use of awaited there (since PromiseLike doesn't guarantee it is a Promise/A+ compatible promise), which may resolve this case.

@rbuckton
Copy link
Member

I am looking into whether #37570 might address this.

@rbuckton
Copy link
Member

It looks like #37540 may help as well, as it reduced the number of failures in our tests significantly: https://github.com/typescript-bot/TypeScript/pull/9/files#diff-0e62d568d28b82cee9e66b2b8fafd290R7

@peterblazejewicz
Copy link

We're working through breaks currently to determine next steps

This has a side effect on the DefinitelyTyped definitions as the CI and local tests include checks for the @next tag: https://github.com/definitelyTyped/DefinitelyTyped/
So some of the PR started to fail recently with an error mentioned:

Property 'then' in type 'Bluebird<R>' is not assignable to the same property in base type 'PromiseLike<R>'.

or:

Property 'then' in type 'MyPromise<T>' is not assignable to the same property in base type 'PromiseLike<T>'.
  Type '<TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => PromiseLike<...>' is not assignable to type '<TResult1 = T, TResult2 = never>(onfulfilled?: (value: awaited T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => PromiseLike<...>'.
    Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
      Types of parameters 'value' and 'value' are incompatible.
        Type 'T' is not assignable to type 'awaited T'.

The impact is hard to asses, as for example jQuery type definitions contains a custom Promise-like definition, so any update for a package using jQuery definition as dependency will now fail under the CI or local tests against @next.

Let me know if you want more details,
Thanks!

@rbuckton
Copy link
Member

@mjbvz We are reverting awaited for TS3.9 while we continue to assess its impact.

@mjbvz
Copy link
Contributor Author

mjbvz commented Mar 25, 2020

Ok, thanks for the quick followup. Let me know if you need any help understanding what the VS Code codebase is doing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants