From 66045979c408bf3c666a86b12c2e2a99b5192f14 Mon Sep 17 00:00:00 2001 From: yj Date: Sat, 24 Apr 2021 19:04:51 -0500 Subject: [PATCH] fix: validate types --- protocols/aave/index.json | 2 +- types.d.ts | 4 ++-- types.js | 13 ++++++++----- types.ts | 13 ++++++++----- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/protocols/aave/index.json b/protocols/aave/index.json index 08961dc..3e308e3 100644 --- a/protocols/aave/index.json +++ b/protocols/aave/index.json @@ -14,7 +14,7 @@ "claim": { "isClaimed": false, "claimer": "", - "signature": "", + "signature": "" }, "isHybrid": false, "hasDelegation": false, diff --git a/types.d.ts b/types.d.ts index 7c4169d..50da1a1 100644 --- a/types.d.ts +++ b/types.d.ts @@ -8,11 +8,11 @@ export declare const ProtocolIo: t.TypeC<{ folder: t.StringC; type: t.UnionC<[t.LiteralC<"snapshot">, t.LiteralC<"compoundish">]>; suffix: t.StringC; - claim: t.TypeC<{ + claim: t.UnionC<[t.PartialC<{ isClaimed: t.BooleanC; claimer: t.StringC; signature: t.StringC; - }>; + }>, t.UndefinedC]>; coinGeckoPriceString: t.StringC; tokenContractAddress: t.StringC; governanceContractAddress: t.UnionC<[t.StringC, t.UndefinedC]>; diff --git a/types.js b/types.js index a350170..a007bef 100644 --- a/types.js +++ b/types.js @@ -30,11 +30,14 @@ exports.ProtocolIo = t.type({ folder: t.string, type: t.union([t.literal("snapshot"), t.literal("compoundish")]), suffix: t.string, - claim: t.type({ - isClaimed: t.boolean, - claimer: t.string, - signature: t.string, - }), + claim: t.union([ + t.partial({ + isClaimed: t.boolean, + claimer: t.string, + signature: t.string, + }), + t.undefined, + ]), coinGeckoPriceString: t.string, tokenContractAddress: t.string, governanceContractAddress: t.union([t.string, t.undefined]), diff --git a/types.ts b/types.ts index a759f42..51ed5eb 100644 --- a/types.ts +++ b/types.ts @@ -9,11 +9,14 @@ export const ProtocolIo = t.type({ folder: t.string, type: t.union([t.literal("snapshot"), t.literal("compoundish")]), suffix: t.string, - claim: t.type({ - isClaimed: t.boolean, - claimer: t.string, - signature: t.string, - }), + claim: t.union([ + t.partial({ + isClaimed: t.boolean, + claimer: t.string, + signature: t.string, + }), + t.undefined, + ]), coinGeckoPriceString: t.string, tokenContractAddress: t.string, governanceContractAddress: t.union([t.string, t.undefined]),