Skip to content

Fix types for node16#146

Merged
kaelzhang merged 3 commits intokaelzhang:masterfrom
jdesrosiers:fix-types-for-node16
Jan 13, 2025
Merged

Fix types for node16#146
kaelzhang merged 3 commits intokaelzhang:masterfrom
jdesrosiers:fix-types-for-node16

Conversation

@jdesrosiers
Copy link
Copy Markdown
Contributor

Fixes #96

This fixes issues with type declarations for imports in various environments. Checks all the boxes at https://arethetypeswrong.github.io/?p=ignore

Changes

  • Added @typescript/eslint to facilitate testing
  • Removed the index.mjs build because it shouldn't be needed anymore and didn't always work
  • Added cjs and mjs tests for testing different situations
  • export = import -- I believe this is the "correct" way to declare the exports for a CommonJS module. Other approaches work in many cases, but this is the only way that works for everything.
  • module.exports.isPathValid = isPathValid -- Apparently there's a difference between this and factory.isPathValid = isPathValid and in some situations, named exports only work when set directly on exports.

Compatibility Considerations

In some situations, this requires that people enable esModuleInterop in their tsconfig.json in order to use import ignore from "ignore". Otherwise they need to use import * as ignore from "ignore". I think it's extremely unlikely that people will find themselves in this situation, but it does technically make this a breaking change.

@kaelzhang kaelzhang merged commit b9eb56c into kaelzhang:master Jan 13, 2025
kaelzhang added a commit that referenced this pull request Jan 13, 2025
@kaelzhang
Copy link
Copy Markdown
Owner

Really thanks for your work buddy. Landed in 7.0.1

kaelzhang added a commit that referenced this pull request Jan 14, 2025
@jdesrosiers jdesrosiers deleted the fix-types-for-node16 branch February 5, 2025 19:54
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.

Typescript support for moduleResolution node16

2 participants