-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Add missing recursive vistor on copied import type nodes
#58165
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| //// [tests/cases/compiler/declarationEmitCrossFileCopiedGeneratedImportType.ts] //// | ||
|
|
||
| //// [index.d.ts] | ||
| export declare class Foo extends Number { | ||
| private _; | ||
| } | ||
| //// [index.d.ts] | ||
| import { Foo } from "../projA"; | ||
| export declare const f: (foo: Foo) => boolean; | ||
| //// [index.d.ts] | ||
| export declare const e: { | ||
| f: (foo: import("../projA").Foo) => boolean; | ||
| }; | ||
| //// [index.ts] | ||
| import {e} from "../projC"; | ||
|
|
||
| export const d = {e}; | ||
|
|
||
| //// [index.js] | ||
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.d = void 0; | ||
| var projC_1 = require("../projC"); | ||
| exports.d = { e: projC_1.e }; | ||
|
|
||
|
|
||
| //// [index.d.ts] | ||
| export declare const d: { | ||
| e: { | ||
| f: (foo: import("../projA").Foo) => boolean; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I didn't also swap to |
||
| }; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| //// [tests/cases/compiler/declarationEmitCrossFileCopiedGeneratedImportType.ts] //// | ||
|
|
||
| === projA/index.d.ts === | ||
| export declare class Foo extends Number { | ||
| >Foo : Symbol(Foo, Decl(index.d.ts, 0, 0)) | ||
| >Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) | ||
|
|
||
| private _; | ||
| >_ : Symbol(Foo._, Decl(index.d.ts, 0, 41)) | ||
| } | ||
| === projB/index.d.ts === | ||
| import { Foo } from "../projA"; | ||
| >Foo : Symbol(Foo, Decl(index.d.ts, 0, 8)) | ||
|
|
||
| export declare const f: (foo: Foo) => boolean; | ||
| >f : Symbol(f, Decl(index.d.ts, 1, 20)) | ||
| >foo : Symbol(foo, Decl(index.d.ts, 1, 25)) | ||
| >Foo : Symbol(Foo, Decl(index.d.ts, 0, 8)) | ||
|
|
||
| === projC/index.d.ts === | ||
| export declare const e: { | ||
| >e : Symbol(e, Decl(index.d.ts, 0, 20)) | ||
|
|
||
| f: (foo: import("../projA").Foo) => boolean; | ||
| >f : Symbol(f, Decl(index.d.ts, 0, 25)) | ||
| >foo : Symbol(foo, Decl(index.d.ts, 1, 8)) | ||
| >Foo : Symbol(Foo, Decl(index.d.ts, 0, 0)) | ||
|
|
||
| }; | ||
| === projD/index.ts === | ||
| import {e} from "../projC"; | ||
| >e : Symbol(e, Decl(index.ts, 0, 8)) | ||
|
|
||
| export const d = {e}; | ||
| >d : Symbol(d, Decl(index.ts, 2, 12)) | ||
| >e : Symbol(e, Decl(index.ts, 2, 18)) | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| //// [tests/cases/compiler/declarationEmitCrossFileCopiedGeneratedImportType.ts] //// | ||
|
|
||
| === projA/index.d.ts === | ||
| export declare class Foo extends Number { | ||
| >Foo : Foo | ||
| > : ^^^ | ||
| >Number : Number | ||
| > : ^^^^^^ | ||
|
|
||
| private _; | ||
| >_ : any | ||
| } | ||
| === projB/index.d.ts === | ||
| import { Foo } from "../projA"; | ||
| >Foo : typeof Foo | ||
| > : ^^^^^^^^^^ | ||
|
|
||
| export declare const f: (foo: Foo) => boolean; | ||
| >f : (foo: Foo) => boolean | ||
| > : ^ ^^ ^^^^^ | ||
| >foo : Foo | ||
| > : ^^^ | ||
|
|
||
| === projC/index.d.ts === | ||
| export declare const e: { | ||
| >e : { f: (foo: import("../projA").Foo) => boolean; } | ||
| > : ^^^^^ ^^^ | ||
|
|
||
| f: (foo: import("../projA").Foo) => boolean; | ||
| >f : (foo: import("../projA").Foo) => boolean | ||
| > : ^ ^^ ^^^^^ | ||
| >foo : import("projA/index").Foo | ||
| > : ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| }; | ||
| === projD/index.ts === | ||
| import {e} from "../projC"; | ||
| >e : { f: (foo: import("projA/index").Foo) => boolean; } | ||
| > : ^^^^^^ ^^ ^^^^^^^^^^^^^^^ | ||
|
|
||
| export const d = {e}; | ||
| >d : { e: { f: (foo: import("projA/index").Foo) => boolean; }; } | ||
| > : ^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^ | ||
| >{e} : { e: { f: (foo: import("projA/index").Foo) => boolean; }; } | ||
| > : ^^^^^ ^^^ | ||
| >e : { f: (foo: import("projA/index").Foo) => boolean; } | ||
| > : ^^^^^^ ^^ ^^^^^^^^^^^^^^^ | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,4 +68,4 @@ export class Encoder<T> implements IEncoder<T> { | |
| */ | ||
| encode(value: T): Uint8Array; | ||
| } | ||
| export type IEncoder<T> = import('./interface').Encoder<T>; | ||
| export type IEncoder<T> = import("./interface").Encoder<T>; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we're doing the recursive visit on the specifier now, the quote-style-conformity change we just made is now also being applied here~ |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,12 +65,12 @@ const b = new B(); | |
| a.copy(b); // error | ||
| >a.copy(b) : void | ||
| > : ^^^^ | ||
| >a.copy : (other: import(} fro).Foo) => void | ||
| > : ^ ^^ ^^^^^^^^^ | ||
| >a.copy : (other: import("b").Foo) => void | ||
| > : ^ ^^ ^^^^^^^^^ | ||
| >a : A | ||
| > : ^ | ||
| >copy : (other: import(} fro).Foo) => void | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That we already had a test demonstrating the issue is... yeah, reviewing big baseline diffs is hard - easy to miss the one test that's still off. And that's why we try and break it down where we can. 🤷♂️
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops! |
||
| > : ^ ^^ ^^^^^^^^^ | ||
| >copy : (other: import("b").Foo) => void | ||
| > : ^ ^^ ^^^^^^^^^ | ||
| >b : B | ||
| > : ^ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // @declaration: true | ||
| // @filename: projA/index.d.ts | ||
| export declare class Foo extends Number { | ||
| private _; | ||
| } | ||
| // @filename: projB/index.d.ts | ||
| import { Foo } from "../projA"; | ||
| export declare const f: (foo: Foo) => boolean; | ||
| // @filename: projC/index.d.ts | ||
| export declare const e: { | ||
| f: (foo: import("../projA").Foo) => boolean; | ||
| }; | ||
| // @filename: projD/index.ts | ||
| import {e} from "../projC"; | ||
|
|
||
| export const d = {e}; |
Uh oh!
There was an error while loading. Please reload this page.