-
Notifications
You must be signed in to change notification settings - Fork 179
Add typescript definitions #1
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
Comments
@rricard - is this working for you? I updated the
Where are you getting your |
I installed the latest tsc from npm using |
@stubailo FYI here's the wrapper hack I wrote to get this working in TS:
|
The type definition file that produces is:
|
Hmm, how do dependencies in TypeScript definition files work? Since this package doesn't actually have a dependency on GraphQL, is it going to be weird? |
I don't thinks so. This is what you already have in your
Where/how did you generate that file? My understanding (as it stands) is that you don't need this package to reference
@stubailo, why not write this module in TS directly, like Apollo-Client |
I wrote it by hand!
Honestly it's too much work to set up the build process for a module this simple - it's like 10 lines of code. |
Fair enough. |
Anyone have the time to write a better definition? |
@stubailo - I suspect this would do the trick: index.d.ts import { Document } from 'graphql';
export default function gql(literals: Array<string>, ...placeholders: Array<string>): Document;
|
OK I'll try this one and republish soon! |
@stubailo I pushed the fix proposed by @philcockfield, which works as expected and fixes the OP bug. Please publish on NPM if that’s good for you. |
Publishing now! |
Done - published as 0.1.10! |
Updating graphql-tag was also required because it’s incorect types definition was raising errors with TS 2.0, see apollographql/graphql-tag#1. I haven’t opt-in for the `strictNullChecks` option yet, for that’s certainly something to do to get the full benefit of this new TS release.
Updating graphql-tag was also required because it’s incorect types definition was raising errors with TS 2.0, see apollographql/graphql-tag#1. I haven’t opt-in for the `strictNullChecks` option yet, for that’s certainly something to do to get the full benefit of this new TS release.
Updating graphql-tag was also required because its incorect types definition was raising errors with TS 2.0, see apollographql/graphql-tag#1. I haven’t opt-in for the `strictNullChecks` option yet, for that’s certainly something to do to get the full benefit of this new TS release.
For now, in some use cases, TS (in atom) warns:
Argument of type 'TemplateStringsArray' is not assignable to parameter of type 'string'.
for using gql like this:The text was updated successfully, but these errors were encountered: