Skip to content

Excessive stack depth comparing types 'Snapshot<T>' and 'DataSnapshot'. [2321] #14794

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

Closed
rtm opened this issue Mar 22, 2017 · 1 comment
Closed
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@rtm
Copy link

rtm commented Mar 22, 2017

TypeScript Version: 2.1.5

Code

interface DataSnapshot {
  child(path: string): DataSnapshot;
}

interface Snapshot<T> extends DataSnapshot {
  child<U extends keyof T>(path: U): Snapshot<T[U]>;
}

Expected behavior:

Should compile.

Actual behavior:

Gives error:

Excessive stack depth comparing types 'Snapshot' and 'DataSnapshot'. [2321]

If the definition of DataSnapshot#child is changed to child(path:string): any; , then no error occurs.

@RyanCavanaugh
Copy link
Member

@ahejlsberg thoughts?

@mhegazy mhegazy added the Bug A bug in TypeScript label Mar 22, 2017
@mhegazy mhegazy added this to the TypeScript 2.3 milestone Mar 22, 2017
@ahejlsberg ahejlsberg added the Fixed A PR has been merged for this issue label Mar 23, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants