-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
Domain: API: ts.transpileDeclarationIssues regarding the transpileDeclaration API, which do not reproduce without itIssues regarding the transpileDeclaration API, which do not reproduce without it
Description
π Search Terms
transpiledeclaration api emit missing import
π Version & Regression Information
- This changed in commit or PR Add
transpileDeclarationAPI methodΒ #58261 @weswigham
β― Playground Link
π» Code
// @strict: true
// @declaration: true
// @showEmit
// @showEmittedFile: a.d.ts
// @showEmittedFile: b.d.ts
// @filename: a.ts
export interface In {
[key: string]: unknown;
}
export interface Out {
[key: string]: unknown;
}
export type Base = 'a' | 'b';
// @filename: b.ts
import { type In, type Out, type Base } from "./a";
export const object = {
doThing<T extends Base>(_t: T, _in: In[T]): Out[T] {
return;
},
};π Actual behavior
When using the API, b.d.ts is emitted as
import { type In } from "./a";
export declare const object: {
doThing<T extends Base>(_t: T, _in: In[T]): Out;
};while when using tsc it gets emitted as
import { type In, type Out, type Base } from "./a";
export declare const object: {
doThing<T extends Base>(_t: T, _in: In[T]): Out[T];
};(interestingly the Debug tab of the workbench link shows something that's partially wrong)
π Expected behavior
Using the API should emit
import { type In, type Out, type Base } from "./a";
export declare const object: {
doThing<T extends Base>(_t: T, _in: In[T]): Out[T];
};Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
Domain: API: ts.transpileDeclarationIssues regarding the transpileDeclaration API, which do not reproduce without itIssues regarding the transpileDeclaration API, which do not reproduce without it