-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use import types to refer to declarations in declaration emit (#24071)
* Stand up a simple implementation using import types for exports of modules which are otherwise inaccessible * Ensure references exist to link to modules containing utilized ambient modules * Accept baselines with new import type usage * Fix lint
- Loading branch information
Showing
77 changed files
with
1,154 additions
and
1,637 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
4 changes: 2 additions & 2 deletions
4
tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.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
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
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
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
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
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
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
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
48 changes: 48 additions & 0 deletions
48
tests/baselines/reference/declarationsForInferredTypeFromOtherFile.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,48 @@ | ||
//// [tests/cases/compiler/declarationsForInferredTypeFromOtherFile.ts] //// | ||
|
||
//// [file1.ts] | ||
export class Foo {} | ||
//// [file2.ts] | ||
export function foo(): import("./file1").Foo { | ||
return null as any; | ||
} | ||
//// [file3.ts] | ||
import {foo} from "./file2"; | ||
export function bar() { | ||
return foo(); | ||
} | ||
|
||
|
||
//// [file1.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var Foo = /** @class */ (function () { | ||
function Foo() { | ||
} | ||
return Foo; | ||
}()); | ||
exports.Foo = Foo; | ||
//// [file2.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
function foo() { | ||
return null; | ||
} | ||
exports.foo = foo; | ||
//// [file3.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var file2_1 = require("./file2"); | ||
function bar() { | ||
return file2_1.foo(); | ||
} | ||
exports.bar = bar; | ||
|
||
|
||
//// [file1.d.ts] | ||
export declare class Foo { | ||
} | ||
//// [file2.d.ts] | ||
export declare function foo(): import("./file1").Foo; | ||
//// [file3.d.ts] | ||
export declare function bar(): import("./file1").Foo; |
22 changes: 22 additions & 0 deletions
22
tests/baselines/reference/declarationsForInferredTypeFromOtherFile.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,22 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
export class Foo {} | ||
>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) | ||
|
||
=== tests/cases/compiler/file2.ts === | ||
export function foo(): import("./file1").Foo { | ||
>foo : Symbol(foo, Decl(file2.ts, 0, 0)) | ||
>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) | ||
|
||
return null as any; | ||
} | ||
=== tests/cases/compiler/file3.ts === | ||
import {foo} from "./file2"; | ||
>foo : Symbol(foo, Decl(file3.ts, 0, 8)) | ||
|
||
export function bar() { | ||
>bar : Symbol(bar, Decl(file3.ts, 0, 28)) | ||
|
||
return foo(); | ||
>foo : Symbol(foo, Decl(file3.ts, 0, 8)) | ||
} | ||
|
25 changes: 25 additions & 0 deletions
25
tests/baselines/reference/declarationsForInferredTypeFromOtherFile.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,25 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
export class Foo {} | ||
>Foo : Foo | ||
|
||
=== tests/cases/compiler/file2.ts === | ||
export function foo(): import("./file1").Foo { | ||
>foo : () => import("tests/cases/compiler/file1").Foo | ||
>Foo : import("tests/cases/compiler/file1").Foo | ||
|
||
return null as any; | ||
>null as any : any | ||
>null : null | ||
} | ||
=== tests/cases/compiler/file3.ts === | ||
import {foo} from "./file2"; | ||
>foo : () => import("tests/cases/compiler/file1").Foo | ||
|
||
export function bar() { | ||
>bar : () => import("tests/cases/compiler/file1").Foo | ||
|
||
return foo(); | ||
>foo() : import("tests/cases/compiler/file1").Foo | ||
>foo : () => import("tests/cases/compiler/file1").Foo | ||
} | ||
|
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
Oops, something went wrong.