-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Domain: ts.transpileDeclarationIssues regarding the transpileDeclaration API, which do not reproduce without itIssues regarding the transpileDeclaration API, which do not reproduce without itFix AvailableA PR has been opened for this issueA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.
Milestone
Description
π Search Terms
transpile declaration api emit enum missing
π Version & Regression Information
- This changed in commit or PR Add
transpileDeclaration
API methodΒ #58261 @weswigham
β― Playground Link
https://github.com/MichaelMitchell-at/transpile_declaration_bug_repro
π» Code
// @strict: true
// @declaration: true
// @showEmit
// @showEmittedFile: a.d.ts
// @showEmittedFile: b.d.ts
// @filename: a.ts
export enum Foo {
A = 'a',
B = 'b',
}
// @filename: b.ts
import {Foo} from './a';
export type Bar = {
[Foo.A]: 1;
[Foo.B]: 2;
}
π Actual behavior
Refer to this program which invokes the ts.transpileDeclaration
API:
https://github.com/MichaelMitchell-at/transpile_declaration_bug_repro/blob/main/transpile.mjs
Basic instructions to invoke it can be found in
https://github.com/MichaelMitchell-at/transpile_declaration_bug_repro/blob/main/README.md
When using the API, b.d.ts
is emitted as
export type Bar = {};
while when using tsc
it gets emitted as
import { Foo } from './a';
export type Bar = {
[Foo.A]: 1;
[Foo.B]: 2;
};
π Expected behavior
Using the API should emit
import { Foo } from './a';
export type Bar = {
[Foo.A]: 1;
[Foo.B]: 2;
};
Additional information about the issue
It's entirely possible that usage of the API is incorrect, though it doesn't seem to deviate from the patterns demonstrated in https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API
Metadata
Metadata
Assignees
Labels
Domain: ts.transpileDeclarationIssues regarding the transpileDeclaration API, which do not reproduce without itIssues regarding the transpileDeclaration API, which do not reproduce without itFix AvailableA PR has been opened for this issueA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.