μ΄ PRκ³Ό ν¨κ» μκ°λ λ΄μ©:
https://github.com/apollographql/apollo-link/pull/804
ExecutionResult<TData>
λ μ΅μ μ ν μ€ν¬λ¦½νΈ μ»΄νμΌλ¬μμ μ€λ₯λ₯Ό λ°μμν΅λλ€.
λ΄ νμ΄νμ€ν¬λ¦½νΈ μ€λ₯:
../node_modules/apollo-link/lib/types.d.ts:22:56 - error TS2315: Type 'ExecutionResult' is not generic.
22 }, C = Record<string, any>, E = Record<string, any>> = ExecutionResult<TData> & {
~~~~~~~~~~~~~~~~~~~~~~
Found 1 error.
μ’μ, μ½λκ° μ¬μ ν ConfirmedTypedμ μλ κ² κ°μΌλ―λ‘ #804μ λμ λ μ½λλ μ¬μ ν μ νν΄μΌ ν©λλ€.
/**
* The result of GraphQL execution.
*
* - `errors` is included when any errors occurred as a non-empty array.
* - `data` is the result of a successful execution of the query.
*/
export interface ExecutionResult<TData = ExecutionResultDataDefault> {
errors?: ReadonlyArray<GraphQLError>;
data?: TData;
}
@types/graphqlμ΄ μ΅μ μνμΈμ§ νμΈν΄μΌ ν©λλ€.
@syndesis λ 10κ°μ λ @types/graphql 0.12.6μ μ¬μ©νκ³ μμμ λ°κ²¬νμ΅λλ€. https://www.npmjs.com/package/@types/graphql
μ§κΈ μ΅μ λ²μ μꡬ μ¬νμ νμΈνλ €κ³ ν©λλ€.
μ΅μ graphql libκ° νμν κ²½μ° μΆ©λΆν 곡μ νμ§λ§ λ€λ₯Έ λΌμ΄λΈλ¬λ¦¬ μ’ μμ±μΌλ‘ μΈν΄ μ΄μ λ²μ μ μμ μλ μμ΅λλ€.
@gaberudy μ°λ¦¬λ μ§κΈ #contributing in slackμμ μ±ν μ€μ λλ€. μ°Έμ¬νκ³ μΆλ€λ©΄
@gaberudy λΉμ μ λν apollo-link-dedupμ μ¬μ©νκ³ μμ΅λκΉ?
graphql-tools
ν¨ν€μ§λ₯Ό κ°μ Έμ¬ λλ λμΌν λ¬Έμ κ° λ°μν©λλ€. π’
package.jsonμμ λ€μκ³Ό κ°μ΄ resolutions
μΉμ
μ μ¬μ©νμ¬ μ΄ λ¬Έμ λ₯Ό ν΄κ²°ν μ μμ΅λλ€.
"resolutions": {
"apollo-link-dedup": "^1.0.13",
"@types/graphql": "^14.0.0"
}
ν΄κ²°λμμΌλ―λ‘ λ«μ΅λλ€. ν΄κ²° λ°©λ²μ΄ μ μλ μμ νμλ μ¬μ ν λ¬Έμ κ° μλ μ¬λμ΄ μμΌλ©΄ μΈμ λ μ§ λ€μ μ΄ μ μμ΅λλ€.
package.jsonμμ λ€μκ³Ό κ°μ΄
resolutions
μΉμ μ μ¬μ©νμ¬ μ΄ λ¬Έμ λ₯Ό ν΄κ²°ν μ μμ΅λλ€."resolutions": { "apollo-link-dedup": "^1.0.13", "@types/graphql": "^14.0.0" }
λΆννλ μ΄κ²μ λλ₯Ό μν΄ λ¬Έμ λ₯Ό ν΄κ²°νμ§ λͺ»νμ΅λλ€
μ΄ λ¬Έμ λ μ¬μ ν ν΄κ²°λμ§ μμμ΅λλ€
μ΄κ²μ μ΅μ ν¨ν€μ§λ‘ μ κ·Έλ μ΄λν ν λ°μν©λλ€. μ°λ¦¬κ° μ΄κ²μ λ€μ μ΄ μ μμ΅λκΉ?
μ μλ ν΄κ²° λ°©λ²μ΄ μλνμ§ μμΌλ©° μ€λ³΅ μ κ±°λ₯Ό μ¬μ©νμ§ μμ΅λλ€.
κ°μ λ¬Έμ κ° μμ΅λλ€.
λλ μ΄λ―Έ μλνλ€:
λ€λ₯Έ μ μμ΄ μμ΅λκΉ?
μ΄ λ¬Έμ μ λν μμ μ¬νμ΄ μμ΅λκΉ?
@qin-guan μ’ μμ±μ μ κ·Έλ μ΄λν΄μΌ νμ§λ§ μ μ΄ μ’ μμ±λ μ κ·Έλ μ΄λν΄μΌ ν©λλ€. κ°μ₯ μ¬μ΄ λ°©λ²μ node_modulesμ μ κΈ νμΌμ μ κ±°ν λ€μ λ€μ μ€μΉνλ κ²μ λλ€. μ κΈ νμΌμ μ κ±°νμ§ μμΌλ©΄ μ€μ λ‘ μ΄μ λ²μ μμ λ©μΆ μ μμ΅λλ€(https://github.com/yarnpkg/yarn/issues/4986 μ°Έμ‘°).
15.0.0 -> 14.6.0μμ graphqlμ λ€μ΄κ·Έλ μ΄λνλ©΄ λ¬Έμ κ° ν΄κ²°λλ κ²μΌλ‘ λνλ¬μ΅λλ€.
@PowerKiKi , @david-wbμ μ루μ μ΄ μ μκ² ν¨κ³Όμ μ΄μμ΅λλ€. λ΄ depsλ₯Ό μ κ·Έλ μ΄λν΄λ μλνμ§ μμμ΅λλ€.
μ΄ ν¨ν€μ§λ μ΅μ graphql: ^15.0.0
λ²μ μΌλ‘ μ€λ¨λ©λλ€. νμλ₯Ό μμ νλ λ°©λ²μ λν μμ΄λμ΄κ° μμ΅λκΉ?
@johannesschobel λκΈμ μμ±νκΈ° μ μ μ½μ΄λ³΄μμμ€. μ§κΈμ λ€μ΄κ·Έλ μ΄λν΄μΌ ν©λλ€.
@OmgImAlexis λ ,
μ, μμμ. κ·Έλ¦¬κ³ 14.6.0
λ‘ λ€μ΄κ·Έλ μ΄λνλ κ²κ³Ό κ΄λ ¨λ "νμ¬ ν΄κ²° λ°©λ²"μ μ½μμ΅λλ€. κ·Έλ¬λ λ€λ₯Έ ν¨ν€μ§κ° μ΄λ―Έ 15.0
μ μμ‘΄νκ³ μκΈ° λλ¬Έμ μ΄κ²μ νμ¬ μ μκ² μ₯μ λ¬Όμ
λλ€.
λͺ¨λ μ μΌ μ’λ€
μ΄ λ¬Έμ λ μ λ§ λμλ€. μ΄λ»κ² μμ§λ μ κ³ μ³μ‘μ΄??
μ΄κ²λ λ°©κΈ λΉνμ΅λλ€...
μ΄ λ¬Έμ λ₯Ό ν΄κ²°ν μ μλ μ μΌν λ°©λ²μ graphqlμ 14.6.0
λ‘ λ€μ΄κ·Έλ μ΄λνλ κ²μ΄μμ΅λλ€.
ν΄λΌμ΄μΈνΈμ λν μ체 node_modules
κ° μλ νλ‘μ νΈ λ£¨νΈ λ΄λΆμ ν΄λΌμ°λ κΈ°λ₯μ λν functions
λλ ν λ¦¬κ° μκΈ° λλ¬Έμ μ΄ μ€λ₯κ° λ°μνμ΅λλ€. ν΄λΌμ΄μΈνΈλ 14 μ리μ¦λ₯Ό μ¬μ©νκ³ μλ²λ 15 μ리μ¦λ₯Ό μ¬μ©νκ³ μμ΅λλ€.
patch-package
λ‘ λ¬Έμ λ₯Ό ν΄κ²°νμ΅λλ€.
λ€μ λ΄μ©μ΄ ν¬ν¨λ functions/patches/graphql+15.0.0.patch
νμΌμ μΆκ°ν©λλ€.
diff --git a/node_modules/graphql/execution/execute.d.ts b/node_modules/graphql/execution/execute.d.ts
index 46a1bc6..4ddbfb5 100644
--- a/node_modules/graphql/execution/execute.d.ts
+++ b/node_modules/graphql/execution/execute.d.ts
@@ -37,15 +37,20 @@ export interface ExecutionContext {
errors: Array<GraphQLError>;
}
+export interface ExecutionResultDataDefault {
+ [key: string]: any;
+}
+
/**
* The result of GraphQL execution.
*
* - `errors` is included when any errors occurred as a non-empty array.
* - `data` is the result of a successful execution of the query.
*/
-export interface ExecutionResult {
+// TS_SPECIFIC: TData and ExecutionResultDataDefault
+export interface ExecutionResult<TData = ExecutionResultDataDefault> {
errors?: ReadonlyArray<GraphQLError>;
- data?: { [key: string]: any } | null;
+ data?: TData | null;
}
export type ExecutionArgs = {
κ·Έλ° λ€μ npx patch-package
λ₯Ό postinstall
μ μΆκ°ν©λλ€.
ν¨μΉλ ts νμ΄νμλ§ μν₯μ λ―ΈμΉλ―λ‘ μ μ€νΈλ¦Όμμ λ¬Έμ λ₯Ό ν΄κ²°ν λκΉμ§ μ²μμλ μΌκ΅΄μ΄ λΆμ΄μ§λ μμ ν μ루μ μΈ κ²μ²λΌ 보μ λλ€.
μ, λ€μ λμκ°μΌ νμ΅λλ€.
"graphql": "^14.6.0"
μμ
"graphql": "10.0.0",
μ΄ μμ μ μννλ €λ©΄.
@gaberudy μ°λ¦¬λ μ΄κ²μ λν μ λ°μ΄νΈλ₯Ό λ³Ό μ μμ΅λκΉ? μ΄μ μ€ννμ§ 3κ°μμ§Έ.
λν "λλλ €μΌ νμ΅λλ€"λΌλ λκΈμ΄ κ³μ νμλμ§ μλλ‘ μ κΈ μ μμ΅λκΉ?
λν 15μμ 14.6.0μΌλ‘ λ€μ΄κ·Έλ μ΄λν΄μΌ νμ΅λλ€.
μ΄κ²μ https://github.com/apollographql/apollo-link/pull/1263 μ μν΄ μμ λμμ§λ§ μμ§ μ΄μ μμ‘΄νλ ν¨ν€μ§μ μμ ν μ νλμ§ μμμ΅λκΉ?
@abernix λ , μ§μ ν΄ μ£Όμ
μ κ°μ¬ν©λλ€. μλ λ¬Έμ κ° ν΄κ²°λκ³ μμ λ κ² κ°μ΅λλ€. κ·Έλ¬λ apollo-client
μ(λ) κ·Έλ μ§ μκ³ μ΄μ λμΌν μ€λ₯λ₯Ό λμ§λλ€.μμ:
@OmgImAlexis
μ°λ¦¬λ μ΄κ²μ λν μ λ°μ΄νΈλ₯Ό λ³Ό μ μμ΅λκΉ? μ΄μ μ€ννμ§ 3κ°μμ§Έ.
2019λ μ λμΉ κ² κ°μμ ;-) λ²μ¨ 1λ μ΄ λμμ΅λλ€.
μλμ ν΄μλ λ° μ’
μμ± λ²μ μ λλ₯Ό μν΄ μμ νμ΅λλ€. κ°μ₯ μ€μν κ²μ apollo-link
ν΄μλκ° ^1.2.14
μ
λλ€. μ΄λ κ² νλ©΄ apollo-linkλ₯Ό μ¬μ©νλ λͺ¨λ ν¨ν€μ§κ° μ΅μ λ²μ μ μ¬μ©νλλ‘ κ°μ ν©λλ€(μ’
μμ±μμ μ§μ νλ λ΄μ©μ κ΄κ³μμ΄). λμκ² κ·Έκ²μ "apollo-link": "1.2.3"μ κ³ μ λ aws-appsync
ν¨ν€μ§μμ΅λλ€.
"resolutions": {
"apollo-link": "^1.2.14"
},
"dependencies": {
"graphql": "^14.6.0",
}
λ°©κΈ μ΄ λ¬Έμ κ° λ°μνμ΅λλ€. λ€μ΄κ·Έλ μ΄λλ ν΄μΌ νλ€. μ΄λ»κ² κ·Έλ° λ¬Έμ κ° μ¬μ ν μ¬κΈ°μ μμ μ μμ΅λκΉ?
μ€μ λ‘ .. [email protected] μΌλ‘ λ€μ΄ κ·Έλ μ΄λνλ©΄ λμκ²λ λ¬Έμ κ° ν΄κ²°λμμ΅λλ€.
[email protected] μ typescriptμ μ΄ μΌλ° μ ν λ¬Έμ κ° μμ
@david-wb λλΆμ 14.6.0μΌλ‘ λ€μ΄κ·Έλ μ΄λν ν μ μλν©λλ€.
ERROR in node_modules/apollo-client/core/watchQueryOptions.d.ts:56:32 - error TS2315: Type 'ExecutionResult' is not generic.
56 refetchQueries?: ((result: ExecutionResult<T>) => RefetchQueryDescription) | RefetchQueryDescription;
~~~~~~~~~~~~~~~~~~
node_modules/apollo-client/core/LocalState.d.ts:40:23 - error TS2315: Type 'ExecutionResult' is not generic.
40 remoteResult: ExecutionResult<TData>;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/apollo-client/core/LocalState.d.ts:44:17 - error TS2315: Type 'ExecutionResult' is not generic.
44 }): Promise<ExecutionResult<TData>>;
~~~~~~~~~~~~~~~~~~~~~~
"graphql": "^15.0.0"
"graphql": "^14.6.0"
λ‘ λ€μ΄κ·Έλ μ΄λνκ³ npm install
νλ©΄ μμ μ€λ₯κ° λ°μνμ΅λλ€.
μ΄κ²μ https://github.com/apollographql/apollo-client/pull/6258μμ ν΄κ²°λμμ΅λλ€. μ¬μ ν μ΄ λ¬Έμ κ° λ°μνλ κ²½μ° [email protected]
λ‘ μ
λ°μ΄νΈν΄ 보μΈμ. κ°μ¬ ν΄μ!
[email protected] λ₯Ό μ¬μ©νλ κ²μ΄ ν¨κ³Όκ° μμμ΅λλ€.
@moritzewert μ¬μ ν ExecutionResult
μ€λ₯ λλ λ€λ₯Έ κ²μ΄ νμλ©λκΉ? μ€ν κ²°κ³Όλ₯Ό κ²μν μ μμ΅λκΉ: npx envinfo<strong i="7">@latest</strong> --preset apollo
μλ
νμΈμ @hwillson λ ,
graphqlμ 14.6.0
μμ 15.0.0
λ‘ μ
κ·Έλ μ΄λν ν μ΄ λ¬Έμ κ° λ°μνμ΅λλ€.
μ€λ₯:
Type 'ExecutionResult' is not generic.
21 | export declare type FetchResult<TData = {
22 | [key: string]: any;
> 23 | }, C = Record<string, any>, E = Record<string, any>> = ExecutionResult<TData> & {
| ^
24 | extensions?: E;
25 | context?: C;
26 | };
Version: typescript 3.9.3
λ΄ νκ²½μ λ€μκ³Ό κ°μ΅λλ€.
$ npx envinfo<strong i="14">@latest</strong> --preset apollo
npx: installed 1 in 1.063s
System:
OS: macOS 10.15.4
Binaries:
Node: 10.19.0 - ~/.nvm/versions/node/v10.19.0/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.1 - ~/code/frontend/node_modules/.bin/npm
Browsers:
Chrome: 83.0.4103.61
Edge: 83.0.478.44
Firefox: 76.0.1
Safari: 13.1
npmPackages:
apollo-boost: ^0.4.7 => 0.4.9
apollo-cache-inmemory: ^1.6.6 => 1.6.6
apollo-client: ^2.6.10 => 2.6.10
apollo-codegen: ^0.20.2 => 0.20.2
apollo-link: ^1.2.14 => 1.2.14
apollo-link-context: ^1.0.20 => 1.0.20
apollo-link-http: ^1.5.17 => 1.5.17
apollo-link-state: ^0.4.2 => 0.4.2
apollo-link-ws: ^1.0.20 => 1.0.20
κ°μ¬ ν΄μ!
κ°μ₯ μ μ©ν λκΈ
15.0.0 -> 14.6.0μμ graphqlμ λ€μ΄κ·Έλ μ΄λνλ©΄ λ¬Έμ κ° ν΄κ²°λλ κ²μΌλ‘ λνλ¬μ΅λλ€.