Redux Toolkit TS: Element implicitly has an ‘any’ type because expression of type ‘string’ can’t be used to index type ‘WritableDraft

You probably have to add an as const assertion:

export const keyHelpers: keyHelpersType = {
    [actionTypes.addUser]: {
        dispatchKey: 'user',
        stateKey: 'user',
} as const

That way it will not be string, but "user".

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top