You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* [WIP] Sketch of derived context
Summary: A sketch of derived contexts as described in #159
Not sure this is how the implemenetaiton should work. Was just focusing on getting things working end to end.
If we go this way, I'd want to focus a bit more on internal architecture as well as error handling.
Test Plan:
ghstack-source-id: 0513dda
Pull Request resolved: #161
* Document derived context
* Cleanup
Copy file name to clipboardExpand all lines: src/Errors.ts
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -607,3 +607,19 @@ export function noTypesDefined() {
607
607
exportfunctiontsConfigNotFound(cwd: string){
608
608
return`Grats: Could not find \`tsconfig.json\` searching in ${cwd}.\n\nSee https://www.typescriptlang.org/download/ for instructors on how to add TypeScript to your project. Then run \`npx tsc --init\` to create a \`tsconfig.json\` file.`;
609
609
}
610
+
611
+
exportfunctioncyclicDerivedContext(){
612
+
return`Cyclic dependency detected in derived context. This derived context value depends upon itself.`;
613
+
}
614
+
615
+
exportfunctioninvalidDerivedContextArgType(){
616
+
return"Invalid type for derived context function argument. Derived context functions may only accept other `@gqlContext` types as arguments.";
return'Expected derived resolver to have an explicit return type. This is needed to allow Grats to "see" which type to treat as a derived context type.';
621
+
}
622
+
623
+
exportfunctionderivedResolverInvalidReturnType(){
624
+
return"Expected derived resolver function's return type to be a type reference. Grats uses this type reference to determine which type to treat as a derived context type.";
0 commit comments