ostrowr/ts-json-validator

[Request] Add test/example for IfThenElseConstraint

mdurling opened this issue · 3 comments

I am trying to use this library with TS 4.1.3. It would be super helpful if the library contained tests or an example on how to use some of the more advanced JSON Schema features, in particular the IfThenElseConstraint

@ostrowr I think there may be a slight problem with the types for If, Then, and Else. The current types:

if?: Then extends SchemaLike ? SchemaLike : Else extends SchemaLike ? SchemaLike : never;
then?: If extends SchemaLike ? SchemaLike : never;
else?: If extends SchemaLike ? SchemaLike : never;

Are causing tsc errors which resolve if I change the definitions as follows:

if?: Then extends SchemaLike ? If : Else extends SchemaLike ? If : never;
then?: If extends SchemaLike ? Then : never;
else?: If extends SchemaLike ? Else : never;

closed by #45

This is fixed in 0.7.1.