Skip to content

tsconfig.json composite: true cause some types errors #4518

Closed

Description

when i create a new vite react project tsconfig.json comes with composite: true which cause some types error on apis and also store

This is my tsconfig

/* tsconfig.app.json*/
{
  "compilerOptions": {
    "composite": true,
    "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
    "target": "ES2020",
    "useDefineForClassFields": true,
    "lib": ["ES2020", "DOM", "DOM.Iterable"],
    "module": "ESNext",
    "skipLibCheck": true,

    /* Bundler mode */
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "moduleDetection": "force",
    "noEmit": true,
    "jsx": "react-jsx",
    "baseUrl": "src",

    /* Linting */
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true
  },
  "include": ["src"]
}

I receive this error:

export const authApi = api.injectEndpoints({
   endpoints: (builder) => ({
     login: builder.mutation<TokenProps, LoginProps>({
	query: (credentials) => ({
	  url: `${ENDPOINT}/token/`,
	  method: "POST",
	  body: credentials,
	}),
     }),
   })
})
export const { useLoginMutation  } = authApi;  

I receive this type error:

/* "The inferred type of 'useLoginMutation' cannot be named without a reference 
to '../../../../../node_modules/@reduxjs/toolkit/dist/query/react/buildHooks'. This is likely not portable. 
A type annotation is necessary" */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions