From cf5c6739a86e91255459184300dbf2dcd40ef28e Mon Sep 17 00:00:00 2001 From: "Sakamoto, Kazunori" Date: Sat, 15 Feb 2020 02:42:53 +0900 Subject: [PATCH] feat(core-js): support esnext.array.last-item/index modules (#42119) --- types/core-js/core-js-tests.ts | 11 ++++++++++- types/core-js/index.d.ts | 10 ++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/types/core-js/core-js-tests.ts b/types/core-js/core-js-tests.ts index ee6513d9da..e94795ce5d 100644 --- a/types/core-js/core-js-tests.ts +++ b/types/core-js/core-js-tests.ts @@ -334,7 +334,7 @@ b = Reflect.setPrototypeOf(a, a); // ############################################################################################# // ECMAScript 7 -// Modules: es7.array.includes, es7.string.at, ees7.string.pad-start, es7.string.pad-end, +// Modules: es7.array.includes, es7.string.at, es7.string.pad-start, es7.string.pad-end, // es7.object.to-array, es7.object.get-own-property-descriptors, es7.regexp.escape, // es7.map.to-json, and es7.set.to-json // ############################################################################################# @@ -350,6 +350,15 @@ s = RegExp.escape(s); a = map.toJSON(); a = set.toJSON(); +// ############################################################################################# +// ECMAScript Proposal +// Modules: esnext.array.last-item, and esnext.array.last-index +// ############################################################################################# + +point = arrayOfPoint.lastItem; +arrayOfPoint.lastItem = point; +i = arrayOfPoint.lastIndex; + // ############################################################################################# // Mozilla JavaScript: Array generics // Modules: js.array.statics diff --git a/types/core-js/index.d.ts b/types/core-js/index.d.ts index 0b07d32f18..8f90714510 100644 --- a/types/core-js/index.d.ts +++ b/types/core-js/index.d.ts @@ -78,6 +78,16 @@ interface Set { toJSON(): any; } +// ############################################################################################# +// ECMAScript Proposal +// Modules: esnext.array.last-item, and esnext.array.last-index +// ############################################################################################# + +interface Array { + lastItem: T; + readonly lastIndex: number; +} + // ############################################################################################# // Mozilla JavaScript: Array generics // Modules: js.array.statics