juanjoDiaz / streamparser-json

Streaming JSON parser in Javascript for Node.js and the browser
MIT License
133 stars 11 forks source link

chore: fix types and module path in package.json #18

Closed drawmindmap closed 2 years ago

drawmindmap commented 2 years ago
  1. fixed "types" path in package.json
  2. fixed "module" path in package.json
  3. export types in utils/types
juanjoDiaz commented 2 years ago

Hi @drawmindmap ,

Thanks for the contribution. What's the use case to export types? Should constants be exported as well?

drawmindmap commented 2 years ago

I need these types when set jsonParser.onValue jsonParser.onValue = (value: JsonPrimitive) => {} But it'ok when I just ignore the type: jsonParser.onValue = value => {} And it would be better if other types or interfaces used in exported classes are exported too, like: JSONParserOpts

tobiasfuhlroth commented 2 years ago

Just wanted to report that i had the same problem with the export definitions package.json and had to manually overwrite the files in order to get it to work.

This was the error i got before making the change: Failed to resolve entry for package "@streamparser/json". The package may have incorrect main/module/exports specified in its package.json. 8:44:12 AM [vite] Internal server error: Failed to resolve entry for package "@streamparser/json". The package may have incorrect main/module/exports specified in its package.json.

Thanks @drawmindmap for the PR which solves the problem.