Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Arrow Functions in Angular2 Typescript - IE11

Will arrow functions written in Typescript for Angular2 work in IE 11? I've read that arrow functions in javascript aren't supported in IE 11 but wasn't sure if this meant they would also not be supported in Typescript.

like image 840
Rich Avatar asked Jan 05 '23 11:01

Rich


2 Answers

TypeScript code gets compiled to JavaScript, and you can specify to which JavaScript version you'd like it to compile to. Whether the generated code will work, depends on the compilation target you have specified in tsconfig.json file or through command-line options for tsc. As long as you have ES5 as a target, the compiled code will work in IE11.

To read more about Compiler Options, see official TypeScript handbook.

like image 54
knikel Avatar answered Jan 07 '23 01:01

knikel


Arrow function in ES 6 specifications are supported in the below list of browsers,

enter image description here

Source

like image 44
Aravind Avatar answered Jan 07 '23 00:01

Aravind