medikoo / type

Runtime validation and processing of JavaScript types
ISC License
35 stars 4 forks source link

chore(TS): Fix when options null enforce type #8

Closed borracciaBlu closed 1 year ago

codecov[bot] commented 1 year ago

Codecov Report

Merging #8 (aad9f5a) into main (c3b4d7f) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main       #8   +/-   ##
=======================================
  Coverage   95.02%   95.02%           
=======================================
  Files          58       58           
  Lines         603      603           
=======================================
  Hits          573      573           
  Misses         30       30           

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

borracciaBlu commented 1 year ago

Hi @medikoo ,

sorry, deeply shame about it. When options was null it was matching the case for {isOptional?: boolean} and so thinking was in a T | null scenario instead of T.

This should fix it.

Let me know if you have any comment on this.

borracciaBlu commented 1 year ago

In local I'm using dtslint as in DefinitelyTyped but I neglected to test it against actual code, and that was the big mistake.

I guess the lesson would be that the ultimate test is actual code in ts and have tsc happy at compile time...