Skip to content

Commit

Permalink
Typescript type safety (#141)
Browse files Browse the repository at this point in the history
* Change gql return type from any to DocumentNode

* Use TemplateStringsArray type from TypeScript

See https://github.com/Microsoft/TypeScript/blob/0477f91dbad209809363323042f34926d3a6e175/lib/lib.es2015.core.d.ts#L544
  • Loading branch information
felixfbecker authored and jnwng committed Feb 6, 2018
1 parent 384a9b2 commit 204cd50
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
4 changes: 3 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export default function gql(literals: any, ...placeholders: any[]): any;
import { DocumentNode } from 'graphql';

export default function gql(template: TemplateStringsArray, ...substitutions: any[]): DocumentNode;
export function resetCaches(): void;
export function disableFragmentWarnings(): void;
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"url": "https://github.com/apollostack/graphql-tag/issues"
},
"homepage": "https://github.com/apollostack/graphql-tag#readme",
"dependencies": {},
"dependencies": {
"@types/graphql": ">=0.8.6 <=0.11.7"
},
"devDependencies": {
"babel-preset-es2015": "^6.9.0",
"babel-register": "^6.9.0",
Expand Down
24 changes: 14 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# yarn lockfile v1


"@types/graphql@>=0.8.6 <=0.11.7":
version "0.11.7"
resolved "https://registry.yarnpkg.com/@types/graphql/-/graphql-0.11.7.tgz#da39a2f7c74e793e32e2bb7b3b68da1691532dd5"

ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
Expand Down Expand Up @@ -527,11 +531,11 @@ globals@^9.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725"

graphql@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.10.0.tgz#29e4f83d85e79245f8496f40a2232e6e5c5baaee"
graphql@^0.11.0:
version "0.11.7"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.11.7.tgz#e5abaa9cb7b7cccb84e9f0836bf4370d268750c6"
dependencies:
iterall "^1.1.0"
iterall "1.1.3"

[email protected]:
version "1.9.2"
Expand Down Expand Up @@ -577,9 +581,9 @@ is-finite@^1.0.0:
dependencies:
number-is-nan "^1.0.0"

iterall@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.1.1.tgz#f7f0af11e9a04ec6426260f5019d9fcca4d50214"
[email protected].3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.1.3.tgz#1cbbff96204056dde6656e2ed2e2226d0e6d72c9"

js-tokens@^3.0.0:
version "3.0.1"
Expand Down Expand Up @@ -764,9 +768,9 @@ repeating@^2.0.0:
dependencies:
is-finite "^1.0.0"

rollup@^0.42.0:
version "0.42.0"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.42.0.tgz#56e791b3a2f3dd7190bbb80a375675f2fe0f9b23"
rollup@^0.45.0:
version "0.45.2"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.45.2.tgz#63a284c2b31234656f24e9e9717fabb6a7f0fa43"
dependencies:
source-map-support "^0.4.0"

Expand Down

0 comments on commit 204cd50

Please sign in to comment.