Skip to content

Instantly share code, notes, and snippets.

@Eyas
Created January 23, 2020 03:19
Show Gist options
  • Save Eyas/5617e6461963f2420265a2edab923fa6 to your computer and use it in GitHub Desktop.
Save Eyas/5617e6461963f2420265a2edab923fa6 to your computer and use it in GitHub Desktop.
+import {ok} from 'assert';
+
+const assert: <T>(item: T|undefined) => asserts
+
function BuildClasses(topics: ReadonlyArray<TypedTopic>, classes: ClassMap) {
for (const topic of topics) {
if (!IsClass(topic)) continue;
const cls = classes.get(topic.Subject.toString());
+ assert(cls);
- if (!cls) {
- throw new Error(/**... class should have been forward declared */);
- }
toClass(cls, topic, classes);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment