Skip to content

Excessive stack depth comparing types with TS 3.2  #29112

@GabrielCastro

Description

@GabrielCastro

TypeScript Version: 3.2.2

Search Terms:
error TS2321: Excessive stack depth comparing types
lodash

Code

import { PartialDeep, pick } from 'lodash';

type MapFunc<T> = (data: PartialDeep<T>) => PartialDeep<T>;

function testFunc<T>(): MapFunc<T> {
  return data => pick<PartialDeep<T>>(data, []) as PartialDeep<T>;
}
{
  "compilerOptions": {
    "target": "es2018",
    "module": "commonjs",
    "lib": ["es2018", "dom"],
    "strict": true,
    "noEmitOnError": true
  }
}

Expected behavior:
This code should compile with TS 3.2 as it will with TS 3.1

Actual behavior:
Compliation fails with the following error

error TS2321: Excessive stack depth comparing types 'PartialDeep<T>' and 'PartialDeep<PartialDeep<T>>'.


Found 2 errors. 

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Mapped TypesThe issue relates to mapped types

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions