Open younho9 opened 3 years ago
I plan to make this package ESM when we can target TS 4.5. I guess we could do this in the meantime.
Are you sure adding export {}
doesn't have any negative side-effects?
TypeScript Playground of CJS Output ({ "module": "commonjs", "target": "ES2019" })
TypeScript Playground of ESM Output ({ "module": "ES2020", "target": "ES2020" })
Well, I'm not completely sure, but there seems to be no difference in the .d.ts
file between cjs and esm within the scope of the current target. If look at the .d.ts
output, you can see that export {}
is added to hide internal variables, whether esm or cjs.
It would be better to consider support when making this package a pure ESM package.
Because
opaque.d.ts
is not module file, unique symbol tag of theOpaque
type is exposedAlso, the typescript compiler does not regard following as an error.
I suggest adding
export {}
inopaque.d.ts
. (This is added if use typescript compiler.)Then, the typescript compiler complains that the tag is not exported.
Upvote & Fund