Skip to content

RangeError: Maximum call stack size exceeded #59821

Closed
@gentlee

Description

@gentlee

🔎 Search Terms

RangeError: Maximum call stack size exceeded

🕗 Version & Regression Information

  • This happens in all versions I tried - from 4.9.5 to 5.5.4
  • This statred in commit ae415 in my repo
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about it
  • I was unable to test this on prior versions because they are too old

⏯ Playground Link

gentlee/react-redux-cache@ae4159b

💻 Code

Probably caused by cycled typing of createCacheReducer -> Cache and Cache -> createCacheReducer in src/reducer:

export const createCacheReducer = <N extends string, T extends Typenames, QP, QR, MP, MR>(
   actions: ReturnType<typeof createActions<N, T, QR, MR>>,
   typenames: Cache<N, T, QP, QR, MP, MR>['typenames'],
   queries: Cache<N, T, QP, QR, MP, MR>['queries'],
   mutations: Cache<N, T, QP, QR, MP, MR>['mutations'],
   cacheOptions: Cache<N, T, QP, QR, MP, MR>['options']
   ...

🙁 Actual behavior

yarn tsc throws:

RangeError: Maximum call stack size exceeded
    at typeToTypeNodeWorker (typescript/lib/tsc.js:44218:42)
    at typeToTypeNodeHelper (/typescript/lib/tsc.js:44214:32)
    at typeToTypeNodeWorker (ypescript/lib/tsc.js:44438:42)
    at typeToTypeNodeHelper (typescript/lib/tsc.js:44214:32)
    at mapToTypeNodes (typescript/lib/tsc.js:44974:40)
    at typeToTypeNodeWorker (typescript/lib/tsc.js:44355:45)
    at typeToTypeNodeHelper (typescript/lib/tsc.js:44214:32)
    at mapToTypeNodes (typescript/lib/tsc.js:44974:40)
    at typeToTypeNodeWorker (typescript/lib/tsc.js:44355:45)
    at typeToTypeNodeHelper (typescript/lib/tsc.js:44214:32)

🙂 Expected behavior

Should be without errors.

Additional information about the issue

In main branch of the repo problem is not happening.

it started happening in support-multiple-caches branch (1 commit ahead) mostly after code from createActions file was added and used.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions