Skip to content

Imports should use explicit .js extensions for moduleResolution=nodenext compatibility #99

@donmccurdy

Description

@donmccurdy

Imports in published .d.ts files must point to .js extensions, and TypeScript has for a very long time been against handling that renaming itself:

The filenames are supposed to be paths that can be resolved after TypeScript compilation, so we are stuck with either ./Filter or ./Filter.js. Currently the codebase has a mix of both ... so that is not great, I would like to clean it up to be consistent one way or the other. 😅

While I'm happy with either in an application, I think that for libraries we may need to use .js — because that's what should appear in the published .d.ts files. It's required for customers using certain configurations, particularly moduleResolution: 'nodenext'. I've had this feedback in some of my personal repositories in the past, longer discussion here:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions