Skip to content

Path mappings have unintuitive behavior if user accidentally adds an extension #12098

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

Was with @zhengbli when we hit the following:

tsconfig.json:

{
    "compilerOptions": {
        "baseUrl": ".",
    	"paths": {
             "foo": ["foo.ts"]
        }
    }
}

foo.ts

export function blah() { }

hello.ts:

import * as x from "foo";

Right now you'll get an error on the import that foo couldn't be resolved.

Even the documentation currently states (incorrectly) that this should be a valid (though the website isn't up to date). Perhaps we should allow users to specify the extension.

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