`argWithHooks` method doesn't exist
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 625
- Avg merge
- 5h 23m
- Merged PRs (30d)
- 24
Description
Really we ought to have this to enable arguments to have their own scopes, so they can be individually hooked.
```diff
diff --git i/graphile-build/graphile-build/src/global.ts w/graphile-build/graphile-build/src/global.ts
index cc842ea4f..b13fef5b6 100644
--- i/graphile-build/graphile-build/src/global.ts
+++ w/graphile-build/graphile-build/src/global.ts
@@ -628,6 +628,7 @@ declare global {
interface ScopeObjectFieldsFieldArgs extends ScopeObjectFieldsField {}
interface ContextObjectFieldsFieldArgs extends ContextObjectFieldsField {
scope: ScopeObjectFieldsFieldArgs;
+ argWithHooks: ArgWithHooksFunction;
}
interface ScopeObjectFieldsFieldArgsArg extends ScopeObjectFieldsFieldArgs {
@@ -668,6 +669,7 @@ declare global {
interface ContextInterfaceFieldsFieldArgs
extends ContextInterfaceFieldsField {
scope: ScopeInterfaceFieldsFieldArgs;
+ argWithHooks: InterfaceArgWithHooksFunction;
}
interface ScopeInterfaceFieldsFieldArgsArg
@@ -829,6 +831,26 @@ declare global {
) => GrafastInputFieldConfig),
) => GrafastInputFieldConfig;
+ // TODO: generics
+ /** @experimental */
+ type ArgWithHooksFunction = (
+ argScope: ScopeObjectFieldsFieldArgsArg,
+ spec:
+ | GrafastArgumentConfig
+ | ((context: ContextObjectFieldsFieldArgsArg) => GrafastArgumentConfig),
+ ) => GrafastArgumentConfig;
+
+ // TODO: types
+ /** @experimental */
+ type InterfaceArgWithHooksFunction = (
+ argScope: ScopeInterfaceFieldsFieldArgsArg,
+ spec:
+ | GraphQLArgumentConfig
+ | ((
+ context: ContextInterfaceFieldsFieldArgsArg,
+ ) => GraphQLArgumentConfig),
+ ) => GraphQLArgumentConfig;
+
// type WatchUnwatch = (triggerChange: TriggerChangeType) => void;
// type SchemaListener = (newSchema: GraphQLSchema) => void;
```
Contributor guide
Assessment
This issue has not been assessed yet.