-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add index signature to IResolvers and IDirectiveResolvers #1357
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few questions otherwise I give a 💚light
@@ -79,10 +79,10 @@ export interface IResolvers<TContext = {{{ getContext }}}> { | |||
{{#each scalars}} | |||
{{ convert name 'typeNames'}}{{#unless @root.config.strict}}?{{/unless}}: GraphQLScalarType; | |||
{{/each}} | |||
} | |||
} & { [typeName: string] : never }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure it won't mark all properties as never
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah looks suspicious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can try it :)
packages/plugins/typescript-resolvers/tests/typescript-resolvers.spec.ts
Outdated
Show resolved
Hide resolved
Please note @kamilkisiela 's notes, and fix CI. |
…rs.spec.ts Co-Authored-By: ardatan <[email protected]>
@dotansimha Fixed 👍 |
How are you supposed to implement this interface? See minimal example: https://github.com/SimenB/ts-codegen-resolver What am I doing wrong? |
on TS 3.3.333 these interfaces are now unimplementable, 'not assignable to type never' error. |
Fixed in #1389
|
Thanks! It almost works 🙂 export type IDirectiveResolvers<Result> = {
client: ClientDirectiveResolver<Result>;
skip: SkipDirectiveResolver<Result>;
include: IncludeDirectiveResolver<Result>;
deprecated: DeprecatedDirectiveResolver<Result>;
} & { [directiveName: string]: DirectiveResolverFn<any, any, TContext> }; |
Could you try again with |
EDIT: Ignore the error, see edit at bottom. The generated code now compiles! I'm having issues passing The field EDIT: Wait no, that's my fault! I do |
@SimenB So, now is it working as expected? |
Yes! 🙂 |
The |
Same here, eagerly awaiting the release so we can upgrade |
Related: #1350 Planned in this PR: - [x] Move all common code from `flow` to a common package. - [x] Make sure `flow` plugin works. - [x] Add the latest changes of `flow` plugin. - [x] Create `typescript` package with the same features as `flow` package. - [x] Write tests for `typescript` package. - [x] Move all common code from `flow-documents` to a common package. - [x] Make sure `flow-documents` plugin works. - [x] Add the latest changes of `flow-documents` plugin. - [x] Create `typescript-documents` package with the same features as `flow-documents` package. - [x] Write tests for `typescript-documents` package. - [x] Move all common code from `flow-resolvers` to a common package. - [x] Make sure `flow-resolvers` plugin works. - [x] Add the latest changes of `flow-resolvers` plugin. - [x] Create `typescript-resolvers` package with the same features as `flow-resolvers` package. - [x] Write tests for `typescript-resolvers` package. - [x] Add missing features from previous `typescript` package. - [x] Add missing features from previous `typescript-documents` package. - [x] Add missing features from previous `typescript-resolvers` package. - [x] Add introspection types @kamilkisiela #1406 - [x] Implement `namingConvention` again @kamilkisiela #1407 - [x] Fix issue with prefix @kamilkisiela #1407 - [x] Apply this: #1357 @ardatan - [x] Refactor `react-apollo` @dotansimha - [x] Refactor `apollo-angular` @dotansimha - [x] Apply fix to Flow plugins: #1413 @kamilkisiela - [x] Refactor `typescript-mongo` @dotansimha - [x] Refactor `stencil-apollo` @ardatan - [x] Remove Handlebars compiler package from all plugins, and add support for tree shaking. @ardatan - [x] Make sure to update packages in `gql-gen init` @kamilkisiela - [x] Rename `XXX-documents` to `XXX-operations` - [x] Move all flatten utils from `core` to `plugin-helpers` and clean `core` package. @kamilkisiela - [x] Deprecate `buildTemplateContext` and `flattenTypes`. @kamilkisiela - [x] Repo cleanup - [x] Update README @kamilkisiela - [x] Update docs @kamilkisiela - [x] Write docs about writing plugins with visitor @kamilkisiela - [x] Update examples - [x] Change packages names @dotansimha
When I am using 0.19.0-alpha.3973cc8b canary version I am not able to generate my regular types. But the resolvers seem to be correct. |
Related to #1133