Skip to content

No type checking on await expression values #2540

Closed
@jplaisted

Description

@jplaisted

There is no type checking on the implicit results of an await expression. To me this seems different than issue #2191.

/** @param {string} arg */
function strFn(arg) {}

async function asyncFn() {
  const v = await Promise.resolve(5);
  strFn(v); // Ignored
}

function callbackFn() {
  Promise.resolve(5).then(strFn); // WARNING
}

Debug link

I assume type checking is done post-transpilation in which case there needs to be casts within each generator switch statement. There is no type safety on the argument to the generator is the fundamental issue here.

Debug link to the above example with casting.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions