Skip to content

Commit 204cd50

Browse files
felixfbeckerjnwng
authored andcommitted
Typescript type safety (#141)
* 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
1 parent 384a9b2 commit 204cd50

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
export default function gql(literals: any, ...placeholders: any[]): any;
1+
import { DocumentNode } from 'graphql';
2+
3+
export default function gql(template: TemplateStringsArray, ...substitutions: any[]): DocumentNode;
24
export function resetCaches(): void;
35
export function disableFragmentWarnings(): void;

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
"url": "https://github.com/apollostack/graphql-tag/issues"
2121
},
2222
"homepage": "https://github.com/apollostack/graphql-tag#readme",
23-
"dependencies": {},
23+
"dependencies": {
24+
"@types/graphql": ">=0.8.6 <=0.11.7"
25+
},
2426
"devDependencies": {
2527
"babel-preset-es2015": "^6.9.0",
2628
"babel-register": "^6.9.0",

yarn.lock

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# yarn lockfile v1
33

44

5+
"@types/graphql@>=0.8.6 <=0.11.7":
6+
version "0.11.7"
7+
resolved "https://registry.yarnpkg.com/@types/graphql/-/graphql-0.11.7.tgz#da39a2f7c74e793e32e2bb7b3b68da1691532dd5"
8+
59
ansi-regex@^2.0.0:
610
version "2.1.1"
711
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
@@ -527,11 +531,11 @@ globals@^9.0.0:
527531
version "1.0.1"
528532
resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725"
529533

530-
graphql@^0.10.0:
531-
version "0.10.0"
532-
resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.10.0.tgz#29e4f83d85e79245f8496f40a2232e6e5c5baaee"
534+
graphql@^0.11.0:
535+
version "0.11.7"
536+
resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.11.7.tgz#e5abaa9cb7b7cccb84e9f0836bf4370d268750c6"
533537
dependencies:
534-
iterall "^1.1.0"
538+
iterall "1.1.3"
535539

536540
537541
version "1.9.2"
@@ -577,9 +581,9 @@ is-finite@^1.0.0:
577581
dependencies:
578582
number-is-nan "^1.0.0"
579583

580-
iterall@^1.1.0:
581-
version "1.1.1"
582-
resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.1.1.tgz#f7f0af11e9a04ec6426260f5019d9fcca4d50214"
584+
585+
version "1.1.3"
586+
resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.1.3.tgz#1cbbff96204056dde6656e2ed2e2226d0e6d72c9"
583587

584588
js-tokens@^3.0.0:
585589
version "3.0.1"
@@ -764,9 +768,9 @@ repeating@^2.0.0:
764768
dependencies:
765769
is-finite "^1.0.0"
766770

767-
rollup@^0.42.0:
768-
version "0.42.0"
769-
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.42.0.tgz#56e791b3a2f3dd7190bbb80a375675f2fe0f9b23"
771+
rollup@^0.45.0:
772+
version "0.45.2"
773+
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.45.2.tgz#63a284c2b31234656f24e9e9717fabb6a7f0fa43"
770774
dependencies:
771775
source-map-support "^0.4.0"
772776

0 commit comments

Comments
 (0)