Skip to content

"unique symbol" is generated to multiple .d.ts files #40786

Closed
@zoltan-mihalyi

Description

@zoltan-mihalyi

TypeScript Version: 4.0.3
Search Terms:
unique symbol, declaration, .d.ts, invalid, TS4023

Code

a.ts

type AX = { readonly A: unique symbol };
export const A: AX = 0 as any;

b.ts

import { A } from './a';
export const A1 = A;

tsconfig.json

{
  "compilerOptions": {
    "declaration": true,
    "strict": true,
    "noImplicitAny": true,
    "rootDir": "src",
    "outDir": "lib"
  }
}

Expected behavior:
Typescript should either throw TS4023, or generate the following code for b.d.ts:

import { A } from './a';
export declare const A1: typeof A;

Actual behavior:
Typescript generates "unique symbol" to both a.d.ts and b.d.ts:

a.d.ts

declare type AX = {
    readonly A: unique symbol;
};
export declare const A: AX;
export {};

b.d.ts

export declare const A1: {
    readonly A: unique symbol;
};

Project Link:
project.zip

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions