Skip to content

Invalid declaration emit for enum value type #2271

@jfirebaugh

Description

@jfirebaugh

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 typescript@5.9

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)

Metadata

Metadata

Assignees

Labels

Domain: Declaration EmitRelated to declaration emit, type printingbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions