GoogleFeud / ts-runtime-checks

A typescript transformer that automatically generates validation code from your types.
https://googlefeud.github.io/ts-runtime-checks/
MIT License
312 stars 7 forks source link

[BUG] Assert<> with a object member which can a be Type or null does not generate the correct code (fails if null) #30

Closed FredTreg closed 1 year ago

FredTreg commented 1 year ago

Describe the bug Check failing playground and hit run. Any type having a member such as:

MyType : {
  member: MySubType | null
}

will incorrectly fail assertion if MySubType is an object type and member value is null

Please also check the working playground: when using string instead of MySubType, assert code is correctly generated.

Playground link failing playground working playground

Expected behavior Assertion code is correct

Additional context 0.3.2