File tree Expand file tree Collapse file tree 10 files changed +38
-20
lines changed Expand file tree Collapse file tree 10 files changed +38
-20
lines changed Original file line number Diff line number Diff line change @@ -46,28 +46,24 @@ generates:
46
46
47
47
` tsconfig.json`:
48
48
49
+ Add `node_modules/apollo-typed-documents/lib/reactHooks.d.ts` in `include` to override the typings for `@apollo/react-hooks`, so that types can be inferred from typed documents.
50
+
51
+ <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/tsconfig.json) -->
52
+ <!-- The below code snippet is automatically added from ./examples/docs/tsconfig.json -->
49
53
` ` ` json
50
54
{
51
55
"compilerOptions": {
52
- "baseUrl ": "." ,
53
- "paths ": {
54
- "@codegen-types ": ["codegenTypes.ts"] ,
55
- "@apollo/react-hooks ": [
56
- "./node_modules/apollo-typed-documents/lib/reactHooks.d.ts"
57
- ]
58
- }
59
- }
56
+ "noEmit ": true ,
57
+ "allowJs ": true,
58
+ "checkJs ": true ,
59
+ "strict ": true,
60
+ "jsx": "react",
61
+ "esModuleInterop": true
62
+ },
63
+ "include": ["src", "node_modules/apollo-typed-documents/lib/reactHooks.d.ts"]
60
64
}
61
65
` ` `
62
-
63
- ` @codegen-types` points to the output of `typescript-operations` graphql-codegen plugin.
64
-
65
- This alias is required, because in ambient module declarations (`.d.ts`) only non relative imports are allowed.
66
-
67
- `@apollo/react-hooks` overrides the types to have generic hooks in your code : [reference](src/reactHooks.ts)
68
-
69
- If you don't have a TypeScript project but instead just want to get type safety and code completion,
70
- the configuration needs to have more options set : [reference](examples/docs/tsconfig.json)
66
+ <!-- AUTO-GENERATED-CONTENT:END -->
71
67
72
68
# ## Example
73
69
Original file line number Diff line number Diff line change 12
12
"@types/node" : " ^12.0.0" ,
13
13
"@types/react" : " ^16.9.0" ,
14
14
"@types/react-dom" : " ^16.9.0" ,
15
+ "apollo-typed-documents" : " link:../.." ,
15
16
"babel-plugin-import-graphql" : " ^2.7.0" ,
16
17
"customize-cra" : " ^0.9.1" ,
17
18
"react" : " ^16.13.1" ,
Original file line number Diff line number Diff line change 15
15
"noEmit" : true ,
16
16
"jsx" : " react"
17
17
},
18
- "include" : [" src" , " ../.. /lib/reactHooks.d.ts" ]
18
+ "include" : [" src" , " node_modules/apollo-typed-documents /lib/reactHooks.d.ts" ]
19
19
}
Original file line number Diff line number Diff line change @@ -1903,6 +1903,10 @@ anymatch@~3.1.1:
1903
1903
normalize-path "^3.0.0"
1904
1904
picomatch "^2.0.4"
1905
1905
1906
+ " apollo-typed-documents@link:../.. " :
1907
+ version "0.0.0"
1908
+ uid ""
1909
+
1906
1910
aproba@^1.1.1 :
1907
1911
version "1.2.0"
1908
1912
resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a"
Original file line number Diff line number Diff line change 8
8
"@testing-library/jest-dom" : " ^4.2.4" ,
9
9
"@testing-library/react" : " ^9.3.2" ,
10
10
"@testing-library/user-event" : " ^7.1.2" ,
11
+ "apollo-typed-documents" : " link:../.." ,
11
12
"babel-plugin-import-graphql" : " ^2.7.0" ,
12
13
"customize-cra" : " ^0.9.1" ,
13
14
"react" : " ^16.13.1" ,
Original file line number Diff line number Diff line change 7
7
"jsx" : " react" ,
8
8
"esModuleInterop" : true
9
9
},
10
- "include" : [" ." , " ../../.. /lib/reactHooks.d.ts" ]
10
+ "include" : [" ." , " ../node_modules/apollo-typed-documents /lib/reactHooks.d.ts" ]
11
11
}
Original file line number Diff line number Diff line change @@ -1891,6 +1891,10 @@ anymatch@~3.1.1:
1891
1891
normalize-path "^3.0.0"
1892
1892
picomatch "^2.0.4"
1893
1893
1894
+ " apollo-typed-documents@link:../.. " :
1895
+ version "0.0.0"
1896
+ uid ""
1897
+
1894
1898
aproba@^1.1.1 :
1895
1899
version "1.2.0"
1896
1900
resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a"
Original file line number Diff line number Diff line change
1
+ {
2
+ "dependencies" : {
3
+ "apollo-typed-documents" : " link:../.."
4
+ }
5
+ }
Original file line number Diff line number Diff line change 7
7
"jsx" : " react" ,
8
8
"esModuleInterop" : true
9
9
},
10
- "include" : [" src" , " ../.. /lib/reactHooks.d.ts" ]
10
+ "include" : [" src" , " node_modules/apollo-typed-documents /lib/reactHooks.d.ts" ]
11
11
}
Original file line number Diff line number Diff line change
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ " apollo-typed-documents@link:../.. " :
6
+ version "0.0.0"
7
+ uid ""
You can’t perform that action at this time.
0 commit comments