CommunitySolidServer
CommunitySolidServer copied to clipboard
feat: Improve vocabulary typings
📁 Related issues
Caused by discussion at https://github.com/CommunitySolidServer/CommunitySolidServer/pull/1388#discussion_r930262263
✍️ Description
Updates Vocabularies.ts
with more precise typings so they can be used as type guards together with some utility types.
VocabularyLocals<typeof AS>
is "Create" | "Delete" | "Update"
VocabularyValues<typeof AS>
is AS.Create | AS.Delete | AS.Update
is "https://www.w3.org/ns/activitystreams#Create" | "https://www.w3.org/ns/activitystreams#Delete" | "https://www.w3.org/ns/activitystreams#Update"
VocabularyTerms<typeof AS>
is AS.terms.Create | AS.terms.Delete | AS.terms.Update
is NamedNode<"https://www.w3.org/ns/activitystreams#Create"> | NamedNode<"https://www.w3.org/ns/activitystreams#Delete"> | NamedNode<"https://www.w3.org/ns/activitystreams#Update">
Honestly these typings are so exciting that the file should be its own npm package.
Honestly these typings are so exciting that the file should be its own npm package.
Now that CSS has its own namespace on github we could potentially extract some of the utility components and put them in separate repositories. Although it might become a bit more hassle to maintain.
Yes some utilities wouldn't hurt. Maybe that one can move to N3.js (but then it needs TypeScript first).