From 09c7487d34864ffd902b38e70b4fe5dcf04e29cd Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Sat, 18 Aug 2018 16:35:01 +0200 Subject: [PATCH] Support type aliases when type-hashing --- src/type-hash.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/type-hash.js b/src/type-hash.js index c132d0a..a1ccbff 100644 --- a/src/type-hash.js +++ b/src/type-hash.js @@ -116,6 +116,12 @@ function hashType(type, level = 0, seenTypes = new Map()) { typeHash: hashType(actualTrait, level + 1, seenTypes) }; } + } else if (rule._isTypeAlias === true) { + /* Should we wrap this in an `alias` to represent alias-level additional constraints? Or should we just return the canonical rule for the _alias itself? */ + props = { + ruleType: "alias", + type: rule._alias + }; } else { throw new Error(`Unrecognized rule type: ${util.inspect(rule)}`); }