typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

Invalid declaration emit for enum value type

Open jfirebaugh opened this issue 2 weeks ago • 0 comments

Steps to reproduce

tsconfig.json:

{
    "compilerOptions": {
        "module": "Node18",
        "skipLibCheck": true,
        "declaration": true,
        "declarationMap": true,
    }
}

schema.ts:

import { SUBSCHEMA } from './subschema.js'

export const SCHEMA = {
  ...SUBSCHEMA,
} as const

subschema.ts:

import { Teams } from './teams.js'

export const SUBSCHEMA = {
  'item': {
    teamName: Teams.A,
  },
} as const

teams.ts:

export enum Teams {
    A = 'a',
    B = 'b',
}

Behavior with [email protected]

Emit for schema.d.ts:

export declare const SCHEMA: {
    readonly item: {
        readonly teamName: import("./teams.js").Teams.A;
    };
};
//# sourceMappingURL=schema.d.ts.map

Behavior with tsgo

Emit for schema.d.ts:

export declare const SCHEMA: {
    readonly item: {
        readonly teamName: import("./teams.js").A;
    };
};
//# sourceMappingURL=schema.d.ts.map

Which is an error on line 3:

Namespace '"/Users/john/scratch/teams"' has no exported member 'A'. ts(2694)

jfirebaugh avatar Dec 08 '25 16:12 jfirebaugh