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

Error in find-all-references for 3 spread types #13654

Open
ghost opened this issue Jan 24, 2017 · 3 comments
Open

Error in find-all-references for 3 spread types #13654

ghost opened this issue Jan 24, 2017 · 3 comments
Labels
Bug A bug in TypeScript
Milestone

Comments

@ghost
Copy link

ghost commented Jan 24, 2017

TypeScript Version: nightly (2.2.0-dev.20170124)

Code

(based on tests/cases/fourslash/findAlRefsObjectSpread.ts)

interface A1 { a: string };
interface A2 { a?: number };
interface A3 { a?: RegExp };
declare let a1: A1;
declare let a2: A2;
declare let a3: A3;
let a12 = { ...a1, ...a2, ...a3 };
a12.a;

Expected behavior:

Find-all-refs for a in a123.a matches the a in all of A1, A2, A3.

Actual behavior:

It only matches the a in A3. If one of the spread elements in the definition of a123 is removed, then it will correctly highlight both remaining spread elements.

CC @sandersn

@sandersn sandersn self-assigned this Jan 24, 2017
@sandersn
Copy link
Member

getRootSymbols isn't called recursively, so retrieval of original symbols from a spread type needs to itself be recursive. It's a linear recursion so it would be better to implement it as a while/push loop in Javascript. The base case is a symbol that is (1) not transient (2) doesn't have a leftSpread property.

@mhegazy mhegazy added the Bug A bug in TypeScript label Jan 24, 2017
@mhegazy mhegazy added this to the TypeScript 2.2 milestone Jan 24, 2017
@sandersn
Copy link
Member

Will be fixed in #13288.

@mhegazy mhegazy modified the milestones: TypeScript 2.2, TypeScript 2.3 Feb 2, 2017
@sandersn sandersn added the Fixed A PR has been merged for this issue label Feb 15, 2017
@mhegazy mhegazy modified the milestones: TypeScript 2.4, TypeScript 2.5 Jun 5, 2017
@mhegazy mhegazy removed the Fixed A PR has been merged for this issue label Oct 9, 2017
@mhegazy mhegazy modified the milestones: TypeScript 2.6, Future Oct 9, 2017
@ghost
Copy link
Author

ghost commented Sep 26, 2018

@sandersn Any way to fix this without #13288?

@sandersn sandersn removed their assignment Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants