juanjoDiaz / streamparser-json

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

chore: refactor Jest configuration to allow `verbatimModuleSyntax` #32

Closed mrazauskas closed 1 year ago

mrazauskas commented 1 year ago

Fixes #27

For reference see TypeScript documentation:

With [the verbatimModuleSyntax] option, what you see is what you get.

That does have some implications when it comes to module interop though. Under this flag, ECMAScript imports and exports won’t be rewritten to require calls when your settings or file extension implied a different module system. Instead, you’ll get an error. If you need to emit code that uses require and module.exports, you’ll have to use TypeScript’s module syntax that predates ES2015

The syntax in this PR follows the one seen in the documentation. That is the change needed to allow verbatimModuleSyntax: true. If you really need it.

mrazauskas commented 1 year ago

@juanjoDiaz One detail which might be important. I was playing with verbatimModuleSyntax: true in one projects which is using const enums and has preserveConstEnums: true. In my case I was expecting enum members to be inlined at use site, but noticed that tsc does not do this if verbatimModuleSyntax: true.

Might be this is something you would like to double check. Reference: https://github.com/microsoft/TypeScript/issues/52669#issuecomment-1686782587