-
Notifications
You must be signed in to change notification settings - Fork 17
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
fix: fix types for PackageJson
exports
#185
Conversation
According to nodejs doc, it can be an array, and TS resolves it. |
@sxzz Yes i saw that. But do you have a package example with it or link to spec how it works when array passed? (we can add back |
Update: Found it in resolution algorithm ( PS it seems about subpaths? |
@sxzz Added back array type with correct specs (it should be only for subpaths and can be either string or object) seems good to you? |
I created a minimal reproduction: https://stackblitz.com/edit/vitejs-vite-jmzo3v?file=index.ts&terminal=dev Run {
"name": "test-pkg",
"exports": ["./a.d.ts", "./b.d.ts", "./c.d.ts"]
} This demonstrates that TypeScript can always resolve array-type exports, whether they are in the root path or a subpath. |
Thanks. I also confirmed with node resolution that does resolve array even more strange... (updated PR to also include top level array 👍🏼 ) |
Fixes regression from #183
Exports field can be string or a nested object. But not an array of string. Passes tests for vue.js case at least.