Skip to content

Fix TS 2.4 PromiseLike Errors With Async in VSCode Codebase #30216

Closed
@mjbvz

Description

@mjbvz

Building VSCode with TS 2.4, we're seeing about 10 errors in async functions around TPromise:

[16:17:43] Error: /Users/matb/projects/vscode/src/vs/workbench/services/textmodelResolver/test/textModelResolverService.test.ts(136,47): Type 'typeof TPromise' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
[16:17:43] Error: /Users/matb/projects/vscode/src/vs/workbench/services/textmodelResolver/test/textModelResolverService.test.ts(136,47): Type 'typeof TPromise' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
  Type 'TPromise<T | PromiseLike<T>>' is not assignable to type 'PromiseLike<T>'.
    Types of property 'then' are incompatible.
      Type '{ <U>(success?: (value: T | PromiseLike<T>) => TPromise<U>, error?: (err: any) => TPromise<U>, pr...' is not assignable to type '<TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, on...'.
        Types of parameters 'success' and 'onfulfilled' are incompatible.
          Types of parameters 'value' and 'value' are incompatible.
            Type 'T | PromiseLike<T>' is not assignable to type 'T'.
              Type 'PromiseLike<T>' is not assignable to type 'T'.
[16:17:43] Error: /Users/matb/projects/vscode/src/vs/workbench/parts/extensions/electron-browser/extensionsViews.ts(119,29): Type 'typeof TPromise' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
[16:17:43] Error: /Users/matb/projects/vscode/src/vs/workbench/parts/extensions/electron-browser/extensionsViews.ts(153,38): Type 'typeof TPromise' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
[16:17:43] Error: /Users/matb/projects/vscode/src/vs/workbench/parts/extensions/electron-browser/extensionsViews.ts(429,29): Type 'typeof TPromise' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
[16:17:43] Error: /Users/matb/projects/vscode/src/vs/workbench/parts/extensions/electron-browser/extensionsViews.ts(447,29): Type 'typeof TPromise' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
[16:17:43] Error: /Users/matb/projects/vscode/src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts(303,28): Type 'typeof TPromise' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
[16:17:43] Error: /Users/matb/projects/vscode/src/vs/platform/extensionManagement/node/extensionGalleryService.ts(358,44): Type 'typeof TPromise' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
[16:17:43] Error: /Users/matb/projects/vscode/src/vs/workbench/electron-browser/extensionHost.ts(355,118): Type 'typeof TPromise' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.

Steps to reproduce

  1. Using VScode insiders.
  2. Clone vscode code base
  3. Run ./scripts/npm install
  4. Open vscode codebase in vscode
  5. Open effected file
  6. Ensure that TS 2.4.1 is active in your workspace by looking in the lower right status bar for the TS version number

Metadata

Metadata

Assignees

Labels

engineeringVS Code - Build / issue tracking / etc.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions