Skip to content

Unexpected type reference between divided modules #10625

Closed
@vvakame

Description

@vvakame

TypeScript Version: 2.0.2

Code

sampleA.ts

{
    // local types
    type Data = string | boolean;
    let obj: Data = true;
    console.log(obj);
}
export { }

sampleB.ts

let v = "str" || true;

export { v }

tsconfig.json

{
    "compilerOptions": {
        "declaration": true,
        "skipDefaultLibCheck": true
    },
    "include": [
        "sample*.ts"
    ]
}

This is minimal settings.
When "declaration": true and "skipDefaultLibCheck": true, this issue is occured.

Expected behavior:

We can compile this code.

Actual behavior:

$ tsc -v
Version 2.0.2
$ tsc -p ./
sampleB.ts(1,5): error TS4023: Exported variable 'v' has or is using name 'Data' from external module "/private/tmp/hogehogehoge/sampleA" but cannot be named.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions