Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add separate type file for esm per TypeScript guidelines #1886

Merged
merged 1 commit into from
May 14, 2023

Conversation

shadowspawn
Copy link
Collaborator

Pull Request

Problem

TypeScript wants a type definition file which matches the implementation file, like foo.js + foo.d.ts, bar.mjs + bar.d.mts.

See #1880 for more detail.

Solution

Adding the file was easy. Working out how to just reexport the existing types was tricky! I am using:

// This is a bit indirect. There is not an index.js, but TypeScript will look for index.d.ts for types.
export * from './index.js';

The direct ./esm.mjs entry is stale, but tidy it up too.

ChangeLog

  • changed: refine "types" exports for ESM to follow TypeScript guidelines

Copy link
Collaborator

@abetomo abetomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@shadowspawn shadowspawn merged commit a4c96e6 into tj:develop May 14, 2023
@shadowspawn shadowspawn deleted the feature/stricter-exports branch May 14, 2023 20:28
@shadowspawn shadowspawn added the pending release Merged into a branch for a future release, but not released yet label May 14, 2023
@shadowspawn shadowspawn removed the pending release Merged into a branch for a future release, but not released yet label Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants