๐ Search Terms
transpile declaration api emit missing import
๐ Version & Regression Information
โฏ Playground Link
https://github.com/MichaelMitchell-at/transpile_declaration_bug_repro/tree/bug2
๐ป Code
// @strict: true
// @declaration: true
// @showEmit
// @showEmittedFile: a.d.ts
// @showEmittedFile: b.d.ts
// @filename: a.ts
export interface Type {}
// @filename: b.ts
import { type Type } from "./a";
export const foo = (_: Type): void => {};
export const bar = (_: import("./a").Type): void => {};
Workbench Repro
๐ Actual behavior
Refer to this program which invokes the ts.transpileDeclaration API:
https://github.com/MichaelMitchell-at/transpile_declaration_bug_repro/blob/bug2/transpile.mjs
Basic instructions to invoke it can be found in
https://github.com/MichaelMitchell-at/transpile_declaration_bug_repro/blob/bug2/README.md
When using the API, b.d.ts is emitted as
export declare const foo: (_: Type) => void;
export declare const bar: (_: any) => void;
while when using tsc it gets emitted as
import { type Type } from "./a";
export declare const foo: (_: Type) => void;
export declare const bar: (_: import("./a").Type) => void;
๐ Expected behavior
Using the API should emit
import { type Type } from "./a";
export declare const foo: (_: Type) => void;
export declare const bar: (_: import("./a").Type) => void;
Additional information about the issue
๐ Search Terms
transpile declaration api emit missing import
๐ Version & Regression Information
transpileDeclarationAPI methodย #58261 @weswighamโฏ Playground Link
https://github.com/MichaelMitchell-at/transpile_declaration_bug_repro/tree/bug2
๐ป Code
Workbench Repro
๐ Actual behavior
Refer to this program which invokes the
ts.transpileDeclarationAPI:https://github.com/MichaelMitchell-at/transpile_declaration_bug_repro/blob/bug2/transpile.mjs
Basic instructions to invoke it can be found in
https://github.com/MichaelMitchell-at/transpile_declaration_bug_repro/blob/bug2/README.md
When using the API,
b.d.tsis emitted aswhile when using
tscit gets emitted as๐ Expected behavior
Using the API should emit
Additional information about the issue