-
Notifications
You must be signed in to change notification settings - Fork 11
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: add types export to package.json for TypeScript resolution #43
Conversation
This commit adds an explicit export for the TypeScript type definitions in the package.json file. It ensures that the types are correctly resolved by TypeScript in environments that adhere to the strict module resolution rules defined by the package's exports field. By including the "types" condition within the "." export, TypeScript tooling can now properly locate the index.d.ts file when the sanity-image package is imported.
I ran into an issue while upgrading a Remix project. It seemed to originate from a modification in the With To double-check that this wasn't just a Remix issue, I spun up a brand-new Next.js app with From what I gather, adding the type definitions to the |
Interesting. I read through the TS documentation on the This all said, this example seems to suggest that |
yeah my understanding is you would have both of them? not really clear either... but yeah i could poke around and see if we can't find the correct way to do this |
I just ran into this issue as well in a Next.js project. At first I was confused because in one project it doesn't give a type error but in my current one it does. I looked at my |
I've gone ahead and released this in v0.1.7 and confirmed that it fixes issues when using @JeffBeltran Thank you again for the contribution! If you do get around to checking if dropping |
This commit adds an explicit export for the TypeScript type definitions in the package.json file. It ensures that the types are correctly resolved by TypeScript in environments that adhere to the strict module resolution rules defined by the package's exports field. By including the "types" condition within the "." export, TypeScript tooling can now properly locate the index.d.ts file when the sanity-image package is imported.