Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lodash] Excessive stack depth comparing types #25632

Closed
rhys-vdw opened this issue May 9, 2018 · 1 comment
Closed

[Lodash] Excessive stack depth comparing types #25632

rhys-vdw opened this issue May 9, 2018 · 1 comment

Comments

@rhys-vdw
Copy link
Contributor

rhys-vdw commented May 9, 2018

function safeFindIndex<T extends object>(
  array: ReadonlyArray<T>,
  matcher: Partial<T>,
  recordName: string,
  assertMatcher: Partial<T> | undefined
): number {
  const index = findIndex(array, matcher)  // ERROR HERE: immutable-array.ts:21
  if (index === -1) {
    reportError(new TypeError(`Couldn't find ${recordName}`), { extra: { matcher } })
  } else {
    const found = array[index]
    if (assertMatcher !== undefined && !isMatch(found, assertMatcher)) {
      reportError(
        new TypeError(`${recordName} was in unexpected state`),
        { extra: { record: found, assertMatcher } }
      )
    }
  }
  return index
}

This code causes this error:

ERROR in [at-loader] TS2321: Excessive stack depth comparing types 'Partial<T>' and 'string | [string, any] | ListIterator<T, boolean> | PartialDeep<T> | undefined'.

ERROR in [at-loader] ./app/assets/javascripts/utilities/immutable-array.ts:21:34
    TS2321: Excessive stack depth comparing types 'Partial<T>' and 'string | [string, any] | ListIterator<T, boolean> | PartialDeep<T> | undefined'.

package versions

  • @types/lodash@4.14.108
  • typescript@2.8.1

This is not an issue with @types/lodash@4.14.106

cc: @aj-r @andy-ms

@ghost
Copy link

ghost commented May 9, 2018

@rhys-vdw Thanks, this looks like a duplicate of microsoft/TypeScript#21592.

It looks like it's fixed in your case if you write matcher: _.PartialDeep<T>, instead of matcher: Partial<T>.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant