Skip to content

Maximum call stack size exceeded when strictNullChecks is enabled. #37008

@ad0ran

Description

@ad0ran

TypeScript Version: 3.8.2

Search Terms:
strictNullChecks, maximum call stack exceeded

Code

tsc --project tsconfig.json

Expected behavior:
The tsc cli to execute without exception

Actual behavior:

RangeError: Maximum call stack size exceeded
    at checkGrammarForDisallowedTrailingComma (C:\Users\adria\Projects\website-fe\node_modules\typescript\lib\tsc.js:55992:56)
    at checkGrammarTypeArguments (C:\Users\adria\Projects\website-fe\node_modules\typescript\lib\tsc.js:56129:20)
    at checkCallExpression (C:\Users\adria\Projects\website-fe\node_modules\typescript\lib\tsc.js:48028:18)
    at checkExpressionWorker (C:\Users\adria\Projects\website-fe\node_modules\typescript\lib\tsc.js:50181:28)
    at checkExpression (C:\Users\adria\Projects\website-fe\node_modules\typescript\lib\tsc.js:50098:38)
    at checkTruthinessExpression (C:\Users\adria\Projects\website-fe\node_modules\typescript\lib\tsc.js:52215:42)
    at checkConditionalExpression (C:\Users\adria\Projects\website-fe\node_modules\typescript\lib\tsc.js:49778:13)
    at checkExpressionWorker (C:\Users\adria\Projects\website-fe\node_modules\typescript\lib\tsc.js:50213:28)
    at checkExpression (C:\Users\adria\Projects\website-fe\node_modules\typescript\lib\tsc.js:50098:38)
    at removeOptionalityFromDeclaredType (C:\Users\adria\Projects\website-fe\node_modules\typescript\lib\tsc.js:44129:33)

Not sure why, but when I disable strictNullChecks, the tsc cli seems to work just fine. But as soon as i set it to true, I get these maximum call stack size exceeded errors.
Here's my config:

{
  "compilerOptions": {
    "incremental": false,
    "target": "es5",
    "module": "commonjs",
    "lib": ["dom", "es2020", "esnext"], 
    "allowJs": false,
    "checkJs": false,
    "jsx": "react",
    "noEmit": true,
    "downlevelIteration": true,
    "isolatedModules": true,
    "noImplicitAny": false,
    "strictNullChecks": true,               
    "strictFunctionTypes": true,            
    "strictBindCallApply": true,            
    "strictPropertyInitialization": true,   
    "noImplicitThis": true,                 
    "alwaysStrict": true,                   
    "noUnusedLocals": true,                 
    "noUnusedParameters": true,
    "moduleResolution": "node",
    "baseUrl": "./",
    "typeRoots": [
      "node_modules/@types",
      "@types"
    ],
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "skipLibCheck": true
  },
  "include": [
    "src/**/*"
  ]
}

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions