You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Those completions are computed based on the contextual type and it seems that return types of getters are not contextually-typed here:
interfaceTest1{foo: (arg: number)=>void;}constt1: Test1={getfoo(){// Parameter 'arg' implicitly has an 'any' type.(7006)return(arg)=>{};},};interfaceTest2{bar: [string]}constt2: Test2={getbar(){// Type 'string[]' is not assignable to type '[string]'.// Target requires 1 element(s) but source may have fewer.(2322)return['']},};
π Search Terms
object literal getter completion
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.5.0-beta#code/JYOwLgpgTgZghgYwgAgILIN7IFDOTAewIAoBKALk2QAcoDrowBPAOTgFsJKQBXdgI2jIAvgG5cyfnCiUsteo1YcuyXgKFjsw7NgQEQAZzDI4ldAF5MEvIRKkqUCGB5QQVvB48B6L8gA8ALTIYFBMwUzUoADmyABE1LHIABbQENYewjiewgA0Op5RTpLSZO6eyI7OrlTpnj7+QSFhzJEgMfGJKY61IunawkA
π» Code
π Actual behavior
π Good completions inside the function body:
π’ Poor completions inside the getter body:
π Expected behavior
It should provide the same completions inside a getter, as it does inside a function.
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: