3 ms·
Typescript does have built-in polyfills. See for yourself. 1. Goto http://www.typescriptlang.org/play/ http://www.typescriptlang.org/play/ 2. Enter the code
by recursive 8y ago
Typescript does have built-in polyfills. See for yourself.
1. Goto http://www.typescriptlang.org/play/ http://www.typescriptlang.org/play/
2. Enter the code `function* gen() { yield "foo"; }`
3. Behold the mighty state machine in the compiled output.
- Arnavion 8y agoSpecifically, TS has polyfills for language features (eg iterators), not library features (eg `Array.prototype[Symbol.iterator]`).
- johnny_reilly 8y agoExactly what Arnavion said. So if you want to write es-latest with TypeScript but support es5 simply set your target to be es5, import core-js for API polyfills and set lib to your desired es version.
- deleted 8y ago[deleted]