env-var icon indicating copy to clipboard operation
env-var copied to clipboard

Add better type checking

Open moltar opened this issue 4 years ago • 4 comments

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 avatar Apr 26 '20 06:04 moltar

@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.

evanshortiss avatar May 12 '20 16:05 evanshortiss

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!

moltar avatar May 14 '20 07:05 moltar

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 avatar May 15 '20 22:05 just-chillin

@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 😄

evanshortiss avatar May 18 '20 13:05 evanshortiss