Skip to Content
Learning TypeScript 2.x - Second Edition
book

Learning TypeScript 2.x - Second Edition

by Remo H. Jansen
April 2018
Beginner content levelBeginner
536 pages
13h 21m
English
Packt Publishing
Content preview from Learning TypeScript 2.x - Second Edition

External TypeScript helpers (tslib)

As we already know, TypeScript allows us to use features of the upcoming ECMAScript specifications. TypeScript uses a series of helper functions to implement some of these features at runtime. The following are some of the helper functions generated by TypeScript:

  • __extends for inheritance
  • __assign for object spread properties
  • __rest for object rest properties
  • __decorate, __param, and __metadata for decorators
  • __awaiter and __generator for async/await

If one of these helpers is required, TypeScript will generate it at compilation time. However, this can be a problem, because the helper is generated in all of the files that require it, which can lead to a lot of duplicated code.

We can use the following ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering TypeScript - Fourth Edition

Mastering TypeScript - Fourth Edition

Nathan Rozentals
Learning TypeScript

Learning TypeScript

Josh Goldberg
TypeScript for Beginners

TypeScript for Beginners

Bharath Thippireddy

Publisher Resources

ISBN: 9781788391474Supplemental Content