Skip to content

Commit

Permalink
Fix #28
Browse files Browse the repository at this point in the history
  • Loading branch information
GoogleFeud committed Jul 31, 2023
1 parent fdef80b commit 4338485
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/gen/validators/genValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export function genValidator(transformer: Transformer, type: ts.Type | undefined
else if (hasBit(type, ts.TypeFlags.Undefined)) return new Validator(type, name, { kind: TypeDataKinds.Undefined }, exp, parent);
else if (hasBit(type, ts.TypeFlags.BooleanLiteral)) return new Validator(type, name, { kind: TypeDataKinds.Boolean, literal: transformer.checker.typeToString(type) === "true" }, exp, parent);
else if (hasBit(type, ts.TypeFlags.AnyOrUnknown)) return;
else if (type.getCallSignatures().length === 1) return new Validator(type, name, { kind: TypeDataKinds.Function }, exp, parent);
else if (type.isClass()) return new Validator(type, name, { kind: TypeDataKinds.Class }, exp, parent);
else if (type.isTypeParameter()) return;
else if (transformer.checker.isTupleType(type)) return new Validator(type, name, { kind: TypeDataKinds.Tuple }, exp, parent, (parent: Validator) => transformer.checker.getTypeArguments(type as ts.TypeReference).map((t, i) => genValidator(transformer, t, i, undefined, parent)));
Expand All @@ -35,6 +34,7 @@ export function genValidator(transformer: Transformer, type: ts.Type | undefined
if (innerSym.members && innerSym.members.has("__new" as ts.__String)) return new Validator(type, name, { kind: TypeDataKinds.Class }, exp, parent);
else return;
}
else if (type.getCallSignatures().length === 1) return new Validator(type, name, { kind: TypeDataKinds.Function }, exp, parent);
else {
// Check has precedence over other utility types
if (type.getProperty("__$check")) {
Expand Down

0 comments on commit 4338485

Please sign in to comment.