Created
January 23, 2020 03:17
-
-
Save Eyas/a59ad953df64d15fd28b1157df1c3df5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Top-level module: | |
const wellKnownTypes = [ ... ]; // Top-level var with more than one "Type". | |
const dataType = ...; | |
function ForwardDeclareClasses(topics: ReadonlyArray<TypedTopic>): ClassMap { | |
const classes = new Map<string, Class>(); | |
for (const wk of wellKnownTypes) { | |
classes.set(wk.subject.toString(), wk); | |
} | |
classes.set(dataType.subject.toString(), wk); | |
for (const topic of topics) { | |
// ... | |
} | |
if (classes.size === 0) { | |
throw new Error('Expected Class topics to exist.'); | |
} | |
return classes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment