-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: API: ts.transpileDeclarationIssues regarding the transpileDeclaration API, which do not reproduce without itIssues regarding the transpileDeclaration API, which do not reproduce without itDomain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts files
Description
π Search Terms
transpiledeclaration api alias generic parameter name
π 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 type Record<Key extends string, Value> = {
[K in Key]: Value;
};
// @filename: b.ts
import { Record } from "./a";
export type Foo<K extends string> = Record<K, number>;
export const obj = {
doThing<K extends string>(_k: K): Foo<K> {
return {} as any;
},
};π Actual behavior
When using the API, b.d.ts is emitted as
import { Record } from "./a";
export type Foo<K extends string> = Record<K, number>;
export declare const obj: {
doThing<K extends string>(_k: K): Record<K_1, number>;
};while when using tsc it gets emitted as
import { Record } from "./a";
export type Foo<K extends string> = Record<K, number>;
export declare const obj: {
doThing<K extends string>(_k: K): Foo<K>;
};π Expected behavior
Using the API should emit
import { Record } from "./a";
export type Foo<K extends string> = Record<K, number>;
export declare const obj: {
doThing<K extends string>(_k: K): Foo<K>;
};Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: API: ts.transpileDeclarationIssues regarding the transpileDeclaration API, which do not reproduce without itIssues regarding the transpileDeclaration API, which do not reproduce without itDomain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts files