Skip to content

Instantly share code, notes, and snippets.

@Alex2357
Alex2357 / TS2.0.6Bug.ts
Created Oct 30, 2016
C:\Users\Alex\WebstormProjects\Tutorial01\Tests>tsc TS2.0.6Bug.ts --target ES6 TS2.0.6Bug.ts(28,21): error TS2322: Type 'void | IFoo[]' is not assignable to ty pe 'IFoo[]'. Type 'void' is not assignable to type 'IFoo[]'.
View TS2.0.6Bug.ts
interface IFoo{
square:number
}
(
async () => {
async function squareFun(i:number) : Promise<IFoo>{
if (i === 2)
throw 'squareFun1 throw 2';
@Alex2357
Alex2357 / TS2.0.6NoBug.ts
Created Oct 30, 2016
No bug C:\Users\Alex\WebstormProjects\Tutorial01\Tests>tsc TS2.0.6NoBug.ts --target ES6 C:\Users\Alex\WebstormProjects\Tutorial01\Tests>tsc TS2.0.6Bug.ts --target ES6 TS2.0.6Bug.ts(28,21): error TS2322: Type 'void | IFoo[]' is not assignable to ty pe 'IFoo[]'. Type 'void' is not assignable to type 'IFoo[]'. C:\Users\Alex\WebstormProjects\Tutoria…
View TS2.0.6NoBug.ts
interface IFoo{
square:number
}
(
async () => {
async function squareFun(i:number) : Promise<IFoo>{
if (i === 2)
throw 'squareFun1 throw 2';