Skip to content

3.6 regression: error TS2321: Excessive stack depth comparing types 'Function<?>' and 'Function<?>'. #33132

@OliverJAsh

Description

@OliverJAsh

TypeScript Version: 3.6.2

Search Terms: excessive stack depth regression comparing types function lodash

Code

tsconfig.json:

{ "compilerOptions": { "allowSyntheticDefaultImports": true, // Disable this and you get more information about the errors? "strictNullChecks": true } }

package.json:

{ "dependencies": { "@types/lodash": "4.14.129", "typescript": "3.6.2" } }

main.ts:

import negate from 'lodash/negate';

Expected behavior:

Compiles

Actual behavior:

$ tsc error TS2321: Excessive stack depth comparing types 'Function<?>' and 'Function<?>'. Found 1 error.

This error doesn't give any helpful information for debugging.

Upgrading @types/lodash to the latest version (4.14.138 at time of writing) seems to fix the issue.

If we disable strictNullChecks, we get a bit more information about the error (for some reason?):

$ tsc error TS2321: Excessive stack depth comparing types 'Function<?>' and 'Function<?>'. node_modules/@types/lodash/ts3.1/common/common.d.ts:194:15 - error TS2589: Type instantiation is excessively deep and possibly infinite. 194 interface Object<T> extends LoDashImplicitWrapper<T> {  ~~~~~~ Found 2 errors.

This did not error in TS 3.5, so I think it's a regression?

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Indexed Access TypesThe issue relates to accessing subtypes via index accessDomain: Mapped TypesThe issue relates to mapped types

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions