Open
Description
TypeScript Version: 3.4.0-dev.201xxxxx
Search Terms:
Code
const w: void = "";
const x: () => void = () => "";
const y: () => Promise<void> = async () => "";
function a(): void {
return "";
}
async function b(): Promise<void> {
return "";
}
const y2: () => Promise<() => void> = async () => () => "";
function a2(): () => void {
return () => "";
}
function b2(): Promise<() => void> {
return () => "";
}
Expected behavior:
Generally speaking, all of them should be an error, or all of them shouldn't be.
Actual behavior:
We have a special "function returning void" rule that allows () => ""
to be assignable to () => void
, but this doesn't carry thru to async scenarios, so a async () => ""
is not assignable to a () => Promise<void>
.