Tide: more recent than the latest release (master branch during March)
TypeScript: 4.6.2 (using es2020 as configured in tsconfig.json)
Node: v16.9.1
Emacs: 28.1
Steps to Reproduce the Bug
Paste the following code into a TS buffer:
async function foo(bar: string | Promise<string>): Promise<void> {
bar = await bar;
console.log(bar);
}
Expected Behavior
When placing point on bar in line 2, the displayed type should be string because await bar can only return string.
Actual Behavior
The type is displayed as string | Promise<string>:
In the next line, it works correctly:
This only happens if the variable on the left pre-exists, i.e. let baz = await bar; or const baz = await bar; does not exhibit this behavior when point is placed on baz.
Check the debugging section. Tide sends the cursor location to the tsserver and doesn't know much. Any bug related to semantics should be reported to typescript repo
Relevant Version Numbers
tsconfig.json
)Steps to Reproduce the Bug
Paste the following code into a TS buffer:
Expected Behavior
When placing point on
bar
in line 2, the displayed type should bestring
becauseawait bar
can only returnstring
.Actual Behavior
The type is displayed as
string | Promise<string>
:In the next line, it works correctly:
This only happens if the variable on the left pre-exists, i.e.
let baz = await bar;
orconst baz = await bar;
does not exhibit this behavior when point is placed onbaz
.