Search Terms
#36239
Suggestion
Allow non returning functions to have contextually required undefined return type.
Use Cases
Examples
declare function f(a: () => undefined): void;
f(() => { }); // error -> ok
f((): undefined => { }); // error -> ok
const g1: () => undefined = () => { }; // error -> ok
const g2 = (): undefined => { }; // error -> ok if possible
function h1() {
}
f(h1); // error -> error
function h2(): undefined { // error -> ok if possible
}
Checklist
My suggestion meets these guidelines:
Search Terms
#36239
Suggestion
Allow non returning functions to have contextually required
undefinedreturn type.Use Cases
Examples
Checklist
My suggestion meets these guidelines: