-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Check resolution of tslib per file #58654
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
484c821
add test showing bad tslib check behavior
gabritto e57ee58
check external emit helper for each file
gabritto 2eb4081
only check tslib helpers once per symbol
gabritto c9d075c
update multiple helper errors case
gabritto bcb28ff
CR: optimization
gabritto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/package1/index.ts(2,16): error TS2343: This syntax requires an imported helper named '__awaiter' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. | ||
|
||
|
||
==== /tsconfig.json (0 errors) ==== | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"target": "ES2016", | ||
"importHelpers": true, | ||
"module": "commonjs", | ||
} | ||
} | ||
|
||
==== /package1/index.ts (1 errors) ==== | ||
export {}; | ||
async function foo(): Promise<void> {} | ||
~~~ | ||
!!! error TS2343: This syntax requires an imported helper named '__awaiter' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. | ||
async function bar(): Promise<void> {} | ||
|
||
==== /package2/index.ts (0 errors) ==== | ||
export {}; | ||
async function foo(): Promise<void> {} | ||
|
||
==== /node_modules/tslib/package.json (0 errors) ==== | ||
{ | ||
"name": "tslib", | ||
"main": "tslib.js", | ||
"typings": "tslib.d.ts" | ||
} | ||
|
||
==== /node_modules/tslib/tslib.d.ts (0 errors) ==== | ||
export const notAHelper: any; | ||
|
||
==== /node_modules/tslib/tslib.js (0 errors) ==== | ||
module.exports.notAHelper = 3; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//// [tests/cases/compiler/tslibMissingHelper.ts] //// | ||
|
||
//// [package.json] | ||
{ | ||
"name": "tslib", | ||
"main": "tslib.js", | ||
"typings": "tslib.d.ts" | ||
} | ||
|
||
//// [tslib.d.ts] | ||
export const notAHelper: any; | ||
|
||
//// [tslib.js] | ||
module.exports.notAHelper = 3; | ||
//// [index.ts] | ||
export {}; | ||
async function foo(): Promise<void> {} | ||
async function bar(): Promise<void> {} | ||
|
||
//// [index.ts] | ||
export {}; | ||
async function foo(): Promise<void> {} | ||
|
||
|
||
//// [index.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
function foo() { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { }); | ||
} | ||
function bar() { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { }); | ||
} | ||
//// [index.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
function foo() { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { }); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//// [tests/cases/compiler/tslibMissingHelper.ts] //// | ||
|
||
=== /package1/index.ts === | ||
export {}; | ||
async function foo(): Promise<void> {} | ||
>foo : Symbol(foo, Decl(index.ts, 0, 10)) | ||
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) | ||
|
||
async function bar(): Promise<void> {} | ||
>bar : Symbol(bar, Decl(index.ts, 1, 38)) | ||
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) | ||
|
||
=== /package2/index.ts === | ||
export {}; | ||
async function foo(): Promise<void> {} | ||
>foo : Symbol(foo, Decl(index.ts, 0, 10)) | ||
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) | ||
|
||
=== /node_modules/tslib/tslib.d.ts === | ||
export const notAHelper: any; | ||
>notAHelper : Symbol(notAHelper, Decl(tslib.d.ts, --, --)) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//// [tests/cases/compiler/tslibMissingHelper.ts] //// | ||
|
||
=== /package1/index.ts === | ||
export {}; | ||
async function foo(): Promise<void> {} | ||
>foo : () => Promise<void> | ||
> : ^^^^^^ | ||
|
||
async function bar(): Promise<void> {} | ||
>bar : () => Promise<void> | ||
> : ^^^^^^ | ||
|
||
=== /package2/index.ts === | ||
export {}; | ||
async function foo(): Promise<void> {} | ||
>foo : () => Promise<void> | ||
> : ^^^^^^ | ||
|
||
=== /node_modules/tslib/tslib.d.ts === | ||
export const notAHelper: any; | ||
>notAHelper : any | ||
> : ^^^ | ||
|
62 changes: 62 additions & 0 deletions
62
tests/baselines/reference/tslibMultipleMissingHelper.errors.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/package1/index.ts(2,16): error TS2343: This syntax requires an imported helper named '__awaiter' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. | ||
/package1/other.ts(3,32): error TS2343: This syntax requires an imported helper named '__rest' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. | ||
/package2/index.ts(2,16): error TS2343: This syntax requires an imported helper named '__awaiter' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. | ||
|
||
|
||
==== /tsconfig.json (0 errors) ==== | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"target": "ES2016", | ||
"importHelpers": true, | ||
"module": "commonjs", | ||
} | ||
} | ||
|
||
==== /package1/index.ts (1 errors) ==== | ||
export {}; | ||
async function foo(): Promise<void> {} | ||
~~~ | ||
!!! error TS2343: This syntax requires an imported helper named '__awaiter' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. | ||
async function bar(): Promise<void> {} | ||
|
||
==== /package1/other.ts (1 errors) ==== | ||
export {}; | ||
export async function noop(): Promise<void> {} | ||
export function spread({ a, ...rest }: { a: number, b: number}) { | ||
~~~~ | ||
!!! error TS2343: This syntax requires an imported helper named '__rest' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. | ||
return { c: "c", ...rest }; | ||
} | ||
|
||
==== /package2/index.ts (1 errors) ==== | ||
export {}; | ||
async function foo(): Promise<void> {} | ||
~~~ | ||
!!! error TS2343: This syntax requires an imported helper named '__awaiter' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. | ||
|
||
==== /package1/node_modules/tslib/package.json (0 errors) ==== | ||
{ | ||
"name": "tslib", | ||
"main": "tslib.js", | ||
"typings": "tslib.d.ts" | ||
} | ||
|
||
==== /package1/node_modules/tslib/tslib.d.ts (0 errors) ==== | ||
export const notAHelper: any; | ||
|
||
==== /package1/node_modules/tslib/tslib.js (0 errors) ==== | ||
module.exports.notAHelper = 3; | ||
|
||
==== /package2/node_modules/tslib/package.json (0 errors) ==== | ||
{ | ||
"name": "tslib", | ||
"main": "tslib.js", | ||
"typings": "tslib.d.ts" | ||
} | ||
|
||
==== /package2/node_modules/tslib/tslib.d.ts (0 errors) ==== | ||
export const notAHelper: any; | ||
|
||
==== /package2/node_modules/tslib/tslib.js (0 errors) ==== | ||
module.exports.notAHelper = 3; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.