-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🤖 Pick PR #47007 (Use features for selected module re...) into releas…
…e-4.5 (#47016) * Cherry-pick PR #47007 into release-4.5 Component commits: 48b9027 Use features for selected module resolution rather than all features for type reference directives, since they can add restrictions to resolutions * Update baselines for error in stable release versions Co-authored-by: Wesley Wigham <[email protected]> Co-authored-by: Andrew Branch <[email protected]>
- Loading branch information
1 parent
c1758b5
commit d710e39
Showing
13 changed files
with
194 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=commonjs).js
This file contains 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,18 @@ | ||
//// [tests/cases/compiler/tripleSlashTypesReferenceWithMissingExports.ts] //// | ||
|
||
//// [index.d.ts] | ||
interface GlobalThing { a: number } | ||
//// [package.json] | ||
{ | ||
"name": "pkg", | ||
"types": "index.d.ts", | ||
"exports": "some-other-thing.js" | ||
} | ||
//// [usage.ts] | ||
/// <reference types="pkg" /> | ||
|
||
const a: GlobalThing = { a: 0 }; | ||
|
||
//// [usage.js] | ||
/// <reference types="pkg" /> | ||
var a = { a: 0 }; |
13 changes: 13 additions & 0 deletions
13
.../baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=commonjs).symbols
This file contains 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,13 @@ | ||
=== tests/cases/compiler/node_modules/pkg/index.d.ts === | ||
interface GlobalThing { a: number } | ||
>GlobalThing : Symbol(GlobalThing, Decl(index.d.ts, 0, 0)) | ||
>a : Symbol(GlobalThing.a, Decl(index.d.ts, 0, 23)) | ||
|
||
=== tests/cases/compiler/usage.ts === | ||
/// <reference types="pkg" /> | ||
|
||
const a: GlobalThing = { a: 0 }; | ||
>a : Symbol(a, Decl(usage.ts, 2, 5)) | ||
>GlobalThing : Symbol(GlobalThing, Decl(index.d.ts, 0, 0)) | ||
>a : Symbol(a, Decl(usage.ts, 2, 24)) | ||
|
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=commonjs).types
This file contains 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,13 @@ | ||
=== tests/cases/compiler/node_modules/pkg/index.d.ts === | ||
interface GlobalThing { a: number } | ||
>a : number | ||
|
||
=== tests/cases/compiler/usage.ts === | ||
/// <reference types="pkg" /> | ||
|
||
const a: GlobalThing = { a: 0 }; | ||
>a : GlobalThing | ||
>{ a: 0 } : { a: number; } | ||
>a : number | ||
>0 : 0 | ||
|
19 changes: 19 additions & 0 deletions
19
...baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node12).errors.txt
This file contains 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,19 @@ | ||
error TS4124: Compiler option 'module' of value 'node12' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. | ||
tests/cases/compiler/usage.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. | ||
|
||
|
||
!!! error TS4124: Compiler option 'module' of value 'node12' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. | ||
==== tests/cases/compiler/node_modules/pkg/index.d.ts (0 errors) ==== | ||
interface GlobalThing { a: number } | ||
==== tests/cases/compiler/node_modules/pkg/package.json (0 errors) ==== | ||
{ | ||
"name": "pkg", | ||
"types": "index.d.ts", | ||
"exports": "some-other-thing.js" | ||
} | ||
==== tests/cases/compiler/usage.ts (1 errors) ==== | ||
/// <reference types="pkg" /> | ||
~~~ | ||
!!! error TS2688: Cannot find type definition file for 'pkg'. | ||
|
||
const a: GlobalThing = { a: 0 }; |
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node12).js
This file contains 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,18 @@ | ||
//// [tests/cases/compiler/tripleSlashTypesReferenceWithMissingExports.ts] //// | ||
|
||
//// [index.d.ts] | ||
interface GlobalThing { a: number } | ||
//// [package.json] | ||
{ | ||
"name": "pkg", | ||
"types": "index.d.ts", | ||
"exports": "some-other-thing.js" | ||
} | ||
//// [usage.ts] | ||
/// <reference types="pkg" /> | ||
|
||
const a: GlobalThing = { a: 0 }; | ||
|
||
//// [usage.js] | ||
/// <reference types="pkg" /> | ||
const a = { a: 0 }; |
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node12).symbols
This file contains 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,13 @@ | ||
=== tests/cases/compiler/node_modules/pkg/index.d.ts === | ||
interface GlobalThing { a: number } | ||
>GlobalThing : Symbol(GlobalThing, Decl(index.d.ts, 0, 0)) | ||
>a : Symbol(GlobalThing.a, Decl(index.d.ts, 0, 23)) | ||
|
||
=== tests/cases/compiler/usage.ts === | ||
/// <reference types="pkg" /> | ||
|
||
const a: GlobalThing = { a: 0 }; | ||
>a : Symbol(a, Decl(usage.ts, 2, 5)) | ||
>GlobalThing : Symbol(GlobalThing, Decl(index.d.ts, 0, 0)) | ||
>a : Symbol(a, Decl(usage.ts, 2, 24)) | ||
|
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node12).types
This file contains 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,13 @@ | ||
=== tests/cases/compiler/node_modules/pkg/index.d.ts === | ||
interface GlobalThing { a: number } | ||
>a : number | ||
|
||
=== tests/cases/compiler/usage.ts === | ||
/// <reference types="pkg" /> | ||
|
||
const a: GlobalThing = { a: 0 }; | ||
>a : GlobalThing | ||
>{ a: 0 } : { a: number; } | ||
>a : number | ||
>0 : 0 | ||
|
19 changes: 19 additions & 0 deletions
19
...selines/reference/tripleSlashTypesReferenceWithMissingExports(module=nodenext).errors.txt
This file contains 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,19 @@ | ||
error TS4124: Compiler option 'module' of value 'nodenext' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. | ||
tests/cases/compiler/usage.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. | ||
|
||
|
||
!!! error TS4124: Compiler option 'module' of value 'nodenext' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. | ||
==== tests/cases/compiler/node_modules/pkg/index.d.ts (0 errors) ==== | ||
interface GlobalThing { a: number } | ||
==== tests/cases/compiler/node_modules/pkg/package.json (0 errors) ==== | ||
{ | ||
"name": "pkg", | ||
"types": "index.d.ts", | ||
"exports": "some-other-thing.js" | ||
} | ||
==== tests/cases/compiler/usage.ts (1 errors) ==== | ||
/// <reference types="pkg" /> | ||
~~~ | ||
!!! error TS2688: Cannot find type definition file for 'pkg'. | ||
|
||
const a: GlobalThing = { a: 0 }; |
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js
This file contains 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,18 @@ | ||
//// [tests/cases/compiler/tripleSlashTypesReferenceWithMissingExports.ts] //// | ||
|
||
//// [index.d.ts] | ||
interface GlobalThing { a: number } | ||
//// [package.json] | ||
{ | ||
"name": "pkg", | ||
"types": "index.d.ts", | ||
"exports": "some-other-thing.js" | ||
} | ||
//// [usage.ts] | ||
/// <reference types="pkg" /> | ||
|
||
const a: GlobalThing = { a: 0 }; | ||
|
||
//// [usage.js] | ||
/// <reference types="pkg" /> | ||
const a = { a: 0 }; |
13 changes: 13 additions & 0 deletions
13
.../baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=nodenext).symbols
This file contains 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,13 @@ | ||
=== tests/cases/compiler/node_modules/pkg/index.d.ts === | ||
interface GlobalThing { a: number } | ||
>GlobalThing : Symbol(GlobalThing, Decl(index.d.ts, 0, 0)) | ||
>a : Symbol(GlobalThing.a, Decl(index.d.ts, 0, 23)) | ||
|
||
=== tests/cases/compiler/usage.ts === | ||
/// <reference types="pkg" /> | ||
|
||
const a: GlobalThing = { a: 0 }; | ||
>a : Symbol(a, Decl(usage.ts, 2, 5)) | ||
>GlobalThing : Symbol(GlobalThing, Decl(index.d.ts, 0, 0)) | ||
>a : Symbol(a, Decl(usage.ts, 2, 24)) | ||
|
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=nodenext).types
This file contains 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,13 @@ | ||
=== tests/cases/compiler/node_modules/pkg/index.d.ts === | ||
interface GlobalThing { a: number } | ||
>a : number | ||
|
||
=== tests/cases/compiler/usage.ts === | ||
/// <reference types="pkg" /> | ||
|
||
const a: GlobalThing = { a: 0 }; | ||
>a : GlobalThing | ||
>{ a: 0 } : { a: number; } | ||
>a : number | ||
>0 : 0 | ||
|
13 changes: 13 additions & 0 deletions
13
tests/cases/compiler/tripleSlashTypesReferenceWithMissingExports.ts
This file contains 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,13 @@ | ||
// @module: commonjs,node12,nodenext | ||
// @filename: node_modules/pkg/index.d.ts | ||
interface GlobalThing { a: number } | ||
// @filename: node_modules/pkg/package.json | ||
{ | ||
"name": "pkg", | ||
"types": "index.d.ts", | ||
"exports": "some-other-thing.js" | ||
} | ||
// @filename: usage.ts | ||
/// <reference types="pkg" /> | ||
|
||
const a: GlobalThing = { a: 0 }; |