π Search Terms
completions promise return expression type async members
π Version & Regression Information
- This is the behavior in every version I tried
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.6.0-dev.20240716#code/C4TwDgpgBAsiAq5oF4oG8CwAoKUBmA9gQFxQDOwATgJYB2A5gNzYC+zW2eArrQMbDUCtKMAgUAFLwBGpcQEooyAHywESKAB8oABUoEAttTIQAPHESQlCtC2zZRE+YpXjMOKAHoAVAEYvH1jk5diA
π» Code
type MyType = {
foo: string;
};
function test(cb: () => MyType | Promise<MyType>) {}
test(() => ({
/*1*/
}));
π Actual behavior
Completions provided at the marker position include catch, foo and then
π Expected behavior
It would be great if in a situation like this promise methods would get at least deprioritized and if they would appear at the bottom of the list.
Additional information about the issue
It's technically okay to return thenables compatible with Promise interface but it should be a very rare situation. I think a DX win here would justify hiding those members completely.
π Search Terms
completions promise return expression type async members
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.6.0-dev.20240716#code/C4TwDgpgBAsiAq5oF4oG8CwAoKUBmA9gQFxQDOwATgJYB2A5gNzYC+zW2eArrQMbDUCtKMAgUAFLwBGpcQEooyAHywESKAB8oABUoEAttTIQAPHESQlCtC2zZRE+YpXjMOKAHoAVAEYvH1jk5diA
π» Code
π Actual behavior
Completions provided at the marker position include
catch,fooandthenπ Expected behavior
It would be great if in a situation like this promise methods would get at least deprioritized and if they would appear at the bottom of the list.
Additional information about the issue
It's technically okay to return thenables compatible with
Promiseinterface but it should be a very rare situation. I think a DX win here would justify hiding those members completely.