alexcaza / export-to-csv

Export a JS collection to CSV; written in TypeScript.
Other
207 stars 48 forks source link

Typechecking not strict enough during development #80

Closed alexcaza closed 8 months ago

alexcaza commented 8 months ago

Describe the bug Typescript seems to lift CsvOutput to string automatically despite it being a NewType, so comparing the result of generateCsv to string won't give a type error.

This can be see in this comment on PR #79.

The cause is unknown currently, but it's suspected to be a tsconfig.json setting that's missing, causing relaxed typechecking.

Expected behavior CsvOutput should not be comparable to a string without using unpack/asString internally.

alexcaza commented 8 months ago

Turns out the issue was with using outdated bun-types. I bumped the version within the lock file and updated the tests so that contributors going forward shouldn't have this issue.

Old versions of bun-types used unknown within expect instead of proper type inference, which is why it flew under the radar.