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

[@apollo/client/link/core] Typescript types are broken #9349

Closed
JustFly1984 opened this issue Jan 22, 2022 · 8 comments
Closed

[@apollo/client/link/core] Typescript types are broken #9349

JustFly1984 opened this issue Jan 22, 2022 · 8 comments
Labels

Comments

@JustFly1984
Copy link

I got next error in my app:

node_modules/@apollo/client/link/core/types.d.ts:20:18 - error TS2430: Interface 'FetchResult<TData, C, E>' incorrectly extends interface 'ExecutionResult<ObjMap<unknown>, ObjMap<unknown>>'.
  Types of property 'data' are incompatible.
    Type 'TData | null' is not assignable to type 'ObjMap<unknown> | null'.
      Type 'TData' is not assignable to type 'ObjMap<unknown> | null'.
        Type 'TData' is not assignable to type 'ObjMap<unknown>'.

20 export interface FetchResult<TData = {

my tsconfig:

{
  "compilerOptions": {
    "allowJs": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "preserveValueImports": false,
    "isolatedModules": true,
    "jsx": "preserve",
    "lib": ["dom", "dom.iterable", "esnext"],
    "module": "esnext",
    "moduleResolution": "node",
    "noEmit": true,
    "noFallthroughCasesInSwitch": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitAny": true,
    "resolveJsonModule": true,
    "skipLibCheck": false,
    "strict": true,
    "alwaysStrict": true,
    "strictNullChecks": true,
    "strictPropertyInitialization": true,
    "target": "esnext",
    "noUncheckedIndexedAccess": true,
    "exactOptionalPropertyTypes": true,
    "importsNotUsedAsValues": "error",
    "noImplicitReturns": true,
    "noPropertyAccessFromIndexSignature": true,
    "incremental": true
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "types/*.d.ts"],
  "exclude": ["node_modules"]
}
@KeithGillette
Copy link
Contributor

KeithGillette commented Jun 27, 2022

Getting same TS2430 error on tsc with skipLibCheck: false with @apollo/[email protected] & [email protected]. This looks similar to an error in #9428.

@AndrejGajdos
Copy link

+1

@phryneas
Copy link
Member

phryneas commented Feb 20, 2023

@AndrejGajdos can you please provide a TypeScript Playground or a minimal reproduction repo that shows this issue? Going by only the information we have here in the issue we will not be able to reproduce it.

@timonmasberg
Copy link

this just came up for us, using 3.10.8

@phryneas
Copy link
Member

phryneas commented Jul 29, 2024

@timonmasberg can you please provide a TypeScript Playground or a minimal reproduction repo that shows this issue? Going by only the information we have here in the issue we will not be able to reproduce it.

(That said, in 3.10.8, FetchResult is not an interface, but a type, and does not extend the type ExecutionResult - are you sure you're getting the same error message?)

@jerelmiller
Copy link
Member

Hey all 👋

I do believe this issue is now outdated. As @phryneas said, FetchResult is a type in more modern versions of the client, not an interface, so I believe this specific TS bug is no longer possible.

If you see similar issues, we'd kindly ask that you open a new issue with a reproduction so we can dig in further. I'm going to go ahead and close this issue. Thanks!

Copy link
Contributor

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.

Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
For general questions, we recommend using StackOverflow or our discord server.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants