Skip to content
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

Typing errors in @graphql-tools/wrap 6.0.13 #1780

Closed
falkenhawk opened this issue Jul 15, 2020 · 5 comments
Closed

Typing errors in @graphql-tools/wrap 6.0.13 #1780

falkenhawk opened this issue Jul 15, 2020 · 5 comments
Labels

Comments

@falkenhawk
Copy link

  • Using graphql-tools 6.0.13 with typescript
  • graphql-tools 6.0.12 did not throw errors

Reproduction: https://codesandbox.io/s/stupefied-water-04jnz

package.json:

{
  "scripts": {
    "postinstall": "tsc"
  },
  "dependencies": {
    "graphql": "^15.3.0",
    "graphql-tools": "^6.0.13"
  },
  "devDependencies": {
    "typescript": "^3.9.6"
  }
}
λ yarn tsc
yarn run v1.22.4
node_modules/@graphql-tools/wrap/transforms/WrapFields.d.ts:20:5 - error TS2416: Property 'transformRequest' in type 'WrapFields' is not assignable to the same property in base type 'Transform'.
  Type '(originalRequest: Request, delegationContext: Record<string, any>, transformationContext: WrapFieldsTransformationContext) => Request' is not assignable to type 'RequestTransform'.
    Types of parameters 'delegationContext' and 'delegationContext' are incompatible.
      Type 'Record<string, any> | undefined' is not assignable to type 'Record<string, any>'.
        Type 'undefined' is not assignable to type 'Record<string, any>'.

20     transformRequest(originalRequest: Request, delegationContext: Record<string, any>, transformationContext: WrapFieldsTransformationContext): Request;
       ~~~~~~~~~~~~~~~~

node_modules/@graphql-tools/wrap/transforms/WrapFields.d.ts:21:5 - error TS2416: Property 'transformResult' in type 'WrapFields' is not assignable to the same property in base type 'Transform'.
  Type '(originalResult: ExecutionResult<Record<string, any>>, delegationContext: Record<string, any>, transformationContext: WrapFieldsTransformationContext) => ExecutionResult<...>' is not assignable to type 'ResultTransform'.
    Types of parameters 'delegationContext' and 'delegationContext' are incompatible.
      Type 'Record<string, any> | undefined' is not assignable to type 'Record<string, any>'.
        Type 'undefined' is not assignable to type 'Record<string, any>'.

21     transformResult(originalResult: ExecutionResult, delegationContext: Record<string, any>, transformationContext: WrapFieldsTransformationContext): ExecutionResult;
       ~~~~~~~~~~~~~~~

node_modules/@graphql-tools/wrap/transforms/WrapType.d.ts:7:5 - error TS2416: Property 'transformRequest' in type 'WrapType' is not assignable to the same property in base type 'Transform'.
  Type '(originalRequest: Request, delegationContext: Record<string, any>, transformationContext: Record<string, any>) => Request' is not assignable to type 'RequestTransform'.
    Types of parameters 'delegationContext' and 'delegationContext' are incompatible.
      Type 'Record<string, any> | undefined' is not assignable to type 'Record<string, any>'.
        Type 'undefined' is not assignable to type 'Record<string, any>'.

7     transformRequest(originalRequest: Request, delegationContext: Record<string, any>, transformationContext: Record<string, any>): Request;
      ~~~~~~~~~~~~~~~~

node_modules/@graphql-tools/wrap/transforms/WrapType.d.ts:8:5 - error TS2416: Property 'transformResult' in type 'WrapType' is not assignable to the same property in base type 'Transform'.
  Type '(originalResult: ExecutionResult<Record<string, any>>, delegationContext: Record<string, any>, transformationContext: Record<string, any>) => ExecutionResult<...>' is not assignable to type 'ResultTransform'.
    Types of parameters 'delegationContext' and 'delegationContext' are incompatible.
      Type 'Record<string, any> | undefined' is not assignable to type 'Record<string, any>'.
        Type 'undefined' is not assignable to type 'Record<string, any>'.

8     transformResult(originalResult: ExecutionResult, delegationContext: Record<string, any>, transformationContext: Record<string, any>): ExecutionResult;
      ~~~~~~~~~~~~~~~


Found 4 errors.

error Command failed with exit code 1.

my tsconfig.json:

{
  "compilerOptions": {
    /* Visit https://aka.ms/tsconfig.json to read more about this file */

    /* Basic Options */
    "module": "commonjs",
    "target": "es2019", // targeting node v12.9+
    "lib": ["es2020"],
    "outDir": "./build",
    "noEmit": true,

    /* Type-Checking Options */
    "strict": true,
    "noImplicitReturns": true,

    /* Module Resolution Options */
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,

    /* Advanced Options */
    "forceConsistentCasingInFileNames": true
  },
  "include": [
    "src/"
  ]
}
@yaacovCR
Copy link
Collaborator

Likely similar to #1605 (comment)

@yaacovCR
Copy link
Collaborator

Fix might be along line of #1614

@falkenhawk
Copy link
Author

falkenhawk commented Jul 15, 2020

But #1614 was already released with v6.0.9 🤔
edit: Ah nvm, different files were modified in that PR. Now we need a similar fix in WrapFields

@yaacovCR
Copy link
Collaborator

See #1783

https://codesandbox.io/s/laughing-raman-gccn1

Let me know how it works for you...

@yaacovCR yaacovCR added bug waiting-for-release Fixed/resolved, and waiting for the next stable release and removed waiting-for-release Fixed/resolved, and waiting for the next stable release labels Jul 16, 2020
@yaacovCR
Copy link
Collaborator

Released in 6.0.14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants