feat(Types): Improve type spec and ignore signatures that use unknown type

This commit is contained in:
Glen Whitney 2022-07-24 12:52:05 -07:00
parent 890752a1e7
commit 358f68fbbd
7 changed files with 129 additions and 70 deletions

12
src/core/utils.mjs Normal file
View file

@ -0,0 +1,12 @@
/* Returns true if set is a subset of the keys of obj */
export function subsetOfKeys(set, obj) {
for (const e of set) {
if (!(e in obj)) return false
}
return true
}
/* Returns a set of all of the types mentioned in a typed-function signature */
export function typesOfSignature(signature) {
return new Set(signature.split(/[^\w\d]/).filter(s => s.length))
}