Skip to content

TS4025: Exported variable '...' has or is using private name '...'. when using Namespace export #42981

Closed
@Jack-Works

Description

@Jack-Works

🔎 Search Terms

exported variable has or is using private name

🕗 Version & Regression Information

  • 4.1.2
  • 4.2.2

didn't verify other versions

💻 Code

main.ts

export const x = add(import("./sub"));
export * as Q from "./sub";
declare function add<T>(x: Promise<T>): T;

sub.ts

export function a() {}

tsconfig.json

{
    "compilerOptions": {
        "target": "ESNext",
        "module": "ESNext",
        "declaration": true
    }
}

run tsc

🙁 Actual behavior

main.ts:1:14 - error TS4025: Exported variable 'x' has or is using private name 'Q'.

1 export const x = add(import("./sub"));

🙂 Expected behavior

No error. If I remove the export * as Q from './sub' it will generate

export declare const x: typeof import("./sub");

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