env-var
env-var copied to clipboard
Add better type checking
Is your feature request related to a problem? Please describe.
Problem: lack of tests for types can introduce defects.
This is a spillover from the discussion in #117 and defects from #119.
Describe the solution you'd like
Add testing for types.
Found this interesting library today: expect-type
Describe alternatives you've considered
Using:
- tsd
- conditional-type-checks (currently used)
Another drastic alternative is to rewrite the project to TypeScript, which will then remove the need to maintain separate types.
Additional context
Can help with a PR.
@moltar thanks for raising this, expect-type
looks pretty nice, though I think tsd
is more mature. Have you used both? What do you think? It would be fantastic to be able to more confidently release with improved checks like these so I'd be very grateful for a PR in this area 🙏
I'm conflicted on rewriting to TS since it narrows the audience of potential contributors, and I think features such as the additional accessors could be challenging.
Have you used both?
Actually haven't used either. Just saw it, and that reminded me to open this issue :)
I'm conflicted on rewriting to TS since it narrows the audience of potential contributors, and I think features such as the additional accessors could be challenging.
That's fair!
Honestly, it would be nice if you didn't use any libraries. One of the major reasons I choose env-var is because it doesn't have any dependencies that may break down the line.
@just-chillin agreed. This would be a devDependency so it won't affect users of the module. I'm much more dubious about adding regular dependencies.
Edit: In other words, I completely agree @just-chillin 😄