You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeFunc_Async<R>=()=>Promise<R>;// no errors here, expected error like below examplesconstfail_NoNullError: Func_Async<Object>=async()=>{for(letindex=0;index<1;++index){returnnull;}return{};};// as expected// error TS2322: Type '() => Promise<null>' is not assignable to type 'Func_Async<Object>constgood_HasNullError: Func_Async<Object>=async()=>{returnnull;};typeFunc_Sync<R>=()=>R;// as expected:// error TS2322: Type '() => {} | null' is not assignable to type 'Func_Sync<Object>'.constgood_HasNullErrorSync: Func_Sync<Object>=()=>{for(letindex=0;index<1;++index){returnnull;}return{};};
Expected behavior:
I expected "return null" in the middle of a for loop within an async method should produce a compiler error with strictNullChecks, much like the other sync and async examples above.
Actual behavior:
The code compiles without any errors.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 2.2.1
strictNullChecks set to true
Code
Expected behavior:
I expected "return null" in the middle of a for loop within an async method should produce a compiler error with strictNullChecks, much like the other sync and async examples above.
Actual behavior:
The code compiles without any errors.
The text was updated successfully, but these errors were encountered: