reduxjs / reselect

Selector library for Redux
MIT License
19.03k stars 671 forks source link

using createSelector.withTypes prevents build #686

Closed factiondavid closed 7 months ago

factiondavid commented 7 months ago

My code was building just fine until I updated to "reselect: 5.10"

I change my createSelector to use createSelector.withTypes as documented here

I'm getting error for file: node_modules/@reduxjs/toolkit/src/createDraftSafeSelector.ts

transforming (12971) ../node_modules/@mui/private-theming/node_modules/@mui/utils/esm/generateUtilityClasses/index.jsnode_modules/@reduxjs/toolkit/src/createDraftSafeSelector.ts:4:77 - error TS2322: Type '(...args: unknown[]) => (...args: unknown[]) => any' is not assignable to type '{ <MemoizeFunction extends UnknownMemoizer, ArgsMemoizeFunction extends UnknownMemoizer = (func: Func, options?: WeakMapMemoizeOptions<...> | undefined) => Func & { ...; }>(options: { ...; }): CreateSelectorFunction<...>; <MemoizeFunction extends UnknownMem...'. Property 'withTypes' is missing in type '(...args: unknown[]) => any' but required in type 'CreateSelectorFunction<any, any, any>'.

4 export const createDraftSafeSelectorCreator: typeof createSelectorCreator = ( ~ 5 ...args: unknown[]

6 ) => {

node_modules/reselect/dist/reselect.d.ts:871:5 871 withTypes: () => CreateSelectorFunction<MemoizeFunction, ArgsMemoizeFunction, OverrideStateType>;

    'withTypes' is declared here.
  node_modules/@reduxjs/toolkit/src/createDraftSafeSelector.ts:4:77
    4 export const createDraftSafeSelectorCreator: typeof createSelectorCreator = (
                                                                                  ~
    5   ...args: unknown[]
6 ) => {
  ~~~~~~
Did you mean to call this expression?

Found 1 error in node_modules/@reduxjs/toolkit/src/createDraftSafeSelector.ts:4

Found 1 error in node_modules/@reduxjs/toolkit/src/createDraftSafeSelector.ts:4`

EskiMojo14 commented 7 months ago

are you importing anything from @redux/toolkit/src? generally my first question would be why your type checker is reading our source files to begin with

factiondavid commented 7 months ago

are you importing anything from @redux/toolkit/src? generally my first question would be why your type checker is reading our source files to begin with

No I'm not importing anything from @redux/toolkit/src. I am using typescript 5.3.3 in project.

EskiMojo14 commented 7 months ago

any chance you could share the repo or a reproduction of the issue?

aryaemami59 commented 7 months ago

Also make sure you have skipLibCheck: true inside your tsconfig.json.

factiondavid commented 7 months ago

any chance you could share the repo or a reproduction of the issue?

I will work on reproducing and sharing.

factiondavid commented 7 months ago

Also make sure you have skipLibCheck: true inside your tsconfig.json.

My ts.config already has that settings enabled.

factiondavid commented 7 months ago

My mistake there was a type being imported from src. Closing.