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

IntelliSense autocomplete doesn't provide suggestions for contextual types in nested functions #50478

Open
jamesopstad opened this issue Aug 26, 2022 · 0 comments
Labels
Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript
Milestone

Comments

@jamesopstad
Copy link

Bug Report

πŸ”Ž Search Terms

intellisense autocomplete nested

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about intellisense.

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

// EXAMPLE

declare function create<T extends 'foo' | 'bar'>(value: T): T;

declare function a<T>(value: T): T;
declare function b<T>(value: T): T;

// autocomplete works
create(a('foo'));

// autocomplete doesn't work
create(a(b('foo')));

// PARTIAL WORKAROUND

type NoInfer<T> = T extends infer U ? U : never;

declare function a2<T>(value: NoInfer<T>): T;

// autocomplete works but type becomes unknown
create(a2(b('foo')));

πŸ™ Actual behavior

When functions are nested the types flow through and are checked correctly but autocomplete doesn't provide suggestions.

πŸ™‚ Expected behavior

I would like autocomplete to provide suggestions for arguments in nested functions, based on the underlying return type. My actual use case involves more complex functions that are used to build nested objects.

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Help Wanted You can do this Experience Enhancement Noncontroversial enhancements labels Aug 26, 2022
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants