ajitid / fzf-for-js

Do fuzzy matching using FZF algorithm in JavaScript
https://fzf.netlify.app
BSD 3-Clause "New" or "Revised" License
887 stars 21 forks source link

Add `types` exports field for TypeScript ESM #119

Closed kidonng closed 1 year ago

kidonng commented 1 year ago

This is required for TypeScript to work under "module": "node16", see https://github.com//microsoft/TypeScript/issues/47792.

netlify[bot] commented 1 year ago

Deploy Preview for fzf ready!

Name Link
Latest commit 333e1b13e861a0ed826ca58595d21fd00c328f3d
Latest deploy log https://app.netlify.com/sites/fzf/deploys/63ff922ca6dd18000898cac3
Deploy Preview https://deploy-preview-119--fzf.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

ajitid commented 1 year ago

Thanks for mentioning the links as well. I don't see an urgency of creating a release so I'll only merge the PR.


Note to myself

Without inclusion of this PR we would receive type errors if module resolution is specified to be "nodenext". (This is different from esnext, and the differences can be read here.) Old way of putting "types" property right in the root of package.json is still supported by TypeScript.

As mentioned in the docs, order matters. That's why the PR puts this property at the very first of ".": {} object.

kidonng commented 1 year ago

This change does not resolve all type errors with node16 though, I'm still figuring out the correct fixes.

ajitid commented 1 year ago

This change does not resolve all type errors with node16 though, I'm still figuring out the correct fixes.

Were you able to figure out the right changes?

ajitid commented 1 year ago

Merging this in and making a release. I just created a Vite app which uses TypeScript v5 and "moduleResolution": "bundler" and found it to be complaining about types. @kidonng if you find anything that is missing in this branch, feel free to make a new PR for it.