-
Notifications
You must be signed in to change notification settings - Fork 45
Use graphql codegen? #3831
Copy link
Copy link
Open
Labels
Description
What would you like to see added?
At least part of #3830 might have been caught if we used graphql-codegen, as the names of the passed variables should be statically checkable.
For using id versus orcid, it looks like there's a way to do tagged types in TypeScript:
declare const tags: unique symbol;
type Tagged<BaseType, Tag extends PropertyKey> =
BaseType & { [tags]: { [K in Tag]: void } };
type UserID = Tagged<string, 'User'>
type ORCID = Tagged<string, 'ORCID'>This is really two separate tasks, and both have potentially far-reaching tendrils, but once done I think we'll end up with something safer.
Alternatives
Instead of codegen, we could start using TypedDocumentNode manually. This would be lower-impact and could be done gradually, but I think it's only worth it if we don't plan to do code generation, as there will still be multiple sources of truth to collate.
Do you have any interest in helping implement the feature?
Yes
Additional information / screenshots
No response
Reactions are currently unavailable