Skip to content

paths does not consistently work #369

Closed
@DanielRosenwasser

Description

@DanielRosenwasser
// tsconfig.json
{
    "compilerOptions": {
        "target": "esnext",
        "module": "nodenext",
        "strict": true,
        "noEmit": true,
        "baseUrl": ".",
        "paths": {
            "@oops/*": ["./a.js"],
            "@oops/*/y": ["./b.js"],
            "@oops/*/y/x": ["./c.js"],
        }
    },
}
// @filename: main.ts
import * as Oops from "@oops/z/y/x";

let value: number = Oops.value;
// @filename: a.ts

export let value = 1;
// @filename: b.ts

export let value = true;
// @filename: c.ts

export let value = "hello!";

If you compile this, it will not always end up with a consistent result. Sometimes it succeeds, and sometimes it fails:

main.ts:4:5 - error TS2322: Type 'string' is not assignable to type 'number'.

4 let value: number = Oops.value;
      ~~~~~


Found 1 error in main.ts:4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions