brianvoe / slim-select

Slim advanced select dropdown
http://slimselectjs.com
MIT License
1.03k stars 195 forks source link

Update paths to type declaration files in package.json #559

Closed Miodec closed 1 month ago

Miodec commented 1 month ago

I was battling my monorepo setup and almost got everything to work except importing slim-select. I was getting an error:

Could not find a declaration file for module 'slim-select'. '/Users/jack/Code/monkeytype/node_modules/slim-select/dist/slimselect.js' implicitly has an 'any' type.
  There are types at '/Users/jack/Code/monkeytype/node_modules/slim-select/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'slim-select' library may need to update its package.json or typings.ts(7016)

which said there are type definitions but could not be resolved due to the exports property. I decided to have a look and the types key was defined incorrectly (im pretty sure the * syntax cannot be used inside the "." key). I updated the path to ./dist/index.d.ts and everything works great.

I also added a ./* export which allows you to import any of the other types like so:

image

Fully resolves #462

brianvoe commented 1 month ago

Sounds good to me. I dont think this would negatively effect anyone else. Ill try to get this in I have a couple of other prs im trying to get in and one more update so hopefully i can get this in soon.

Miodec commented 4 weeks ago

Hey, any update on this release? We would love to delete all our @ts-expect-error :) image

Thanks for you work!

brianvoe commented 3 weeks ago

Sorry im working on it when i can. ill be able to put some time into it tonight after work.