-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tslib): add tslib helpers to global (#6351)
* feat(tslib): add tslib helpers to global * Adds tslib as a dependency to tns-core-modules * Replaces globals/decorators with globals/tslib * Adds support for async/await, rest and spread operators. * refactor: rename tslib to ts-helpers to avoid confusion with npm package
- Loading branch information
Showing
9 changed files
with
40 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Required by V8 snapshot generator | ||
if (!global.__extends) { | ||
global.__extends = function (d, b) { | ||
for (var p in b) { | ||
if (b.hasOwnProperty(p)) { | ||
d[p] = b[p]; | ||
} | ||
} | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
} | ||
|
||
import * as tslib from "tslib"; | ||
|
||
// Bind the tslib helpers to global scope. | ||
// This is needed when we don't use importHelpers, which | ||
// breaks extending native-classes | ||
for (const fnName of Object.keys(tslib)) { | ||
if (typeof tslib[fnName] !== "function") { | ||
continue; | ||
} | ||
|
||
if (fnName in global) { | ||
// Don't override globals that are already defined (ex. __extends) | ||
continue; | ||
} | ||
|
||
global[fnName] = tslib[fnName]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters