diff options
Diffstat (limited to 'src/find-reverse.js')
-rw-r--r-- | src/find-reverse.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/find-reverse.js b/src/find-reverse.js index f31d3c45..c99a4a71 100644 --- a/src/find-reverse.js +++ b/src/find-reverse.js @@ -11,16 +11,23 @@ export function getAllSpecs({ }) { try { thingConstructors; - } catch (error) { + } catch { throw new Error(`Thing constructors aren't ready yet, can't get all ${word} specs`); } const specs = {...hardcodedSpecs}; + const seenSpecs = new Set(); + for (const thingConstructor of Object.values(thingConstructors)) { const thingSpecs = thingConstructor[constructorKey]; if (!thingSpecs) continue; + // Subclasses can expose literally the same static properties + // by inheritence. We don't want to double-count those! + if (seenSpecs.has(thingSpecs)) continue; + seenSpecs.add(thingSpecs); + for (const [key, spec] of Object.entries(thingSpecs)) { specs[key] = postprocessSpec(spec, { @@ -45,7 +52,7 @@ export function findSpec(key, { try { thingConstructors; - } catch (error) { + } catch { throw new Error(`Thing constructors aren't ready yet, can't check if "${word}.${key}" available`); } |