Skip to content

JSR Converts *.d.ts Imports and Exports to *.js in NPM Projects #1019

@DauntlessStudio

Description

@DauntlessStudio

With a package exported to JSR and imported to a Node project via npx jsr add <package> *.d.ts files have their imports/exports modified from import/export ...d.ts to import/export ...js.

Package Source

The following project structure will have the error.

types/
├── some_type.d.ts
└── index.d.ts
api/
└── mod.ts

some_type.d.ts

export type SomeType = string;

index.ts

export * from "./some_type.d.ts";

mod.ts

import * from "../types/index.d.ts";

Node Modules

When imported into node_modules the imported version of index.d.ts will have been converted from

export * from "./some_type.d.ts";

to

export * from "./some_type.js";

This only occurs in the *.d.ts files, mod.ts will correctly maintain its *.d.ts imports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions