TypeScript/tests/baselines/reference/doYouNeedToChangeYourTargetLibraryES2015.js
Vincent Boivin 61aadc4ce2
fix(40320): Better errors when using properties/methods from newer versions of ECMAScript (#40650)
* Update package-lock.json

* Suggesting a library for a missing property/method

* Added more types and added tests

* Added more tests to cover all the latest features

* Added bigintarrays and dataview methods

* Fixed typo in template

* Transform old error message to use 2nd template slot

* Removed test that has been split up between es2015 and es2016+

* Use empty arrays and remove unnecessary function call

* merge

* Added early bail-out and updated baselines

* Implemented early bail-out (misread)

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2020-10-02 16:47:37 -07:00

191 lines
8.1 KiB
TypeScript

//// [doYouNeedToChangeYourTargetLibraryES2015.ts]
// es2015
const noOp = () => {};
const testReflectApply = Reflect.apply(noOp, this, []);
const testReflectConstruct = Reflect.construct(noOp, []);
const testReflectDefineProperty = Reflect.defineProperty({}, "", {});
const testReflectDeleteProperty = Reflect.deleteProperty({}, "");
const testReflectGet = Reflect.get({}, "");
const testReflectGetOwnPropertyDescriptor = Reflect.getOwnPropertyDescriptor({}, "");
const testReflectGetPrototypeOf = Reflect.getPrototypeOf({});
const testReflectIsExtensible = Reflect.isExtensible({});
const testReflectOwnKeys = Reflect.ownKeys({});
const testReflectPreventExtensions = Reflect.preventExtensions({});
const testReflectSet = Reflect.set({}, "", 0);
const testReflectSetPrototypeOf = Reflect.setPrototypeOf({}, {});
const testArrayFind = [""].find((val, idx, obj) => {
return true;
});
const testArrayFindIndex = [""].findIndex((val, idx, obj) => {
return true;
});
const testArrayFill = [""].fill("fill");
const testArrayCopyWithin = [""].copyWithin(0, 0);
const testArrayEntries = [""].entries();
const testArrayKeys = [""].keys();
const testArrayValues = [""].values();
const testArrayConstructorFrom = Array.from([]);
const testArrayConstructorOf = Array.of([]);
const testObjectConstructorAssign = Object.assign({}, {});
const testObjectConstructorGetOwnPropertySymbols = Object.getOwnPropertySymbols({});
const testObjectConstructorKeys = Object.keys({});
const testObjectConstructorIs = Object.is({}, {});
const testObjectConstructorSetPrototypeOf = Object.setPrototypeOf({}, {});
const testNumberConstructorIsFinite = Number.isFinite(0);
const testNumberConstructorIsInteger = Number.isInteger(0);
const testNumberConstructorIsNan = Number.isNaN(0);
const testNumberConstructorIsSafeInteger = Number.isSafeInteger(0);
const testNumberConstructorParseFloat = Number.parseFloat("0");
const testNumberConstructorParseInt = Number.parseInt("0");
const testMathClz32 = Math.clz32(0);
const testMathImul = Math.imul(0,0);
const testMathSign = Math.sign(0);
const testMathLog10 = Math.log10(0);
const testMathLog2 = Math.log2(0);
const testMathLog1p = Math.log1p(0);
const testMathExpm1 = Math.expm1(0);
const testMathCosh = Math.cosh(0);
const testMathSinh = Math.sinh(0);
const testMathTanh = Math.tanh(0);
const testMathAcosh = Math.acosh(0);
const testMathAsinh = Math.asinh(0);
const testMathAtanh = Math.atanh(0);
const testMathHypot = Math.hypot(0,0);
const testMathTrunc = Math.trunc(0);
const testMathFround = Math.fround(0);
const testMathCbrt = Math.cbrt(0);
const testMap: Map<any, any> = null as any;
const testSet: Set<any> = null as any;
const testPromiseAll = Promise.all([]);
const testPromiseRace = Promise.race([]);
const testPromiseResolve = Promise.resolve();
const testPromiseReject = Promise.reject();
const testSymbolFor = Symbol.for('a');
const testSymbolKeyFor = Symbol.keyFor(testSymbolFor);
const testWeakMap: WeakMap<any, any> = null as any;
const testWeakSet: WeakMap<any, any> = null as any;
const testIterator: Iterator<any, any, any> = null as any;
const testAsyncIterator: AsyncIterator<any, any, any> = null as any;
const testStringCodePointAt = "".codePointAt(0);
const testStringIncludes = "".includes("");
const testStringEndsWith = "".endsWith("");
const testStringNormalize = "".normalize();
const testStringRepeat = "".repeat(0);
const testStringStartsWith = "".startsWith("");
const testStringAnchor = "".anchor("");
const testStringBig = "".big();
const testStringBlink = "".blink();
const testStringBold = "".bold();
const testStringFixed = "".fixed();
const testStringFontColor = "".fontcolor("blue");
const testStringFontSize = "".fontsize(0);
const testStringItalics = "".italics();
const testStringLink = "".link("");
const testStringSmall = "".small();
const testStringStrike = "".strike();
const testStringSub = "".sub();
const testStringSup = "".sup();
const testStringConstructorFromCodePoint = String.fromCodePoint();
const testStringConstructorRaw = String.raw``;
const testRegExpFlags = /abc/g.flags;
const testRegExpSticky = /abc/g.sticky;
const testRegExpUnicode = /abc/g.unicode;
//// [doYouNeedToChangeYourTargetLibraryES2015.js]
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
// es2015
var noOp = function () { };
var testReflectApply = Reflect.apply(noOp, this, []);
var testReflectConstruct = Reflect.construct(noOp, []);
var testReflectDefineProperty = Reflect.defineProperty({}, "", {});
var testReflectDeleteProperty = Reflect.deleteProperty({}, "");
var testReflectGet = Reflect.get({}, "");
var testReflectGetOwnPropertyDescriptor = Reflect.getOwnPropertyDescriptor({}, "");
var testReflectGetPrototypeOf = Reflect.getPrototypeOf({});
var testReflectIsExtensible = Reflect.isExtensible({});
var testReflectOwnKeys = Reflect.ownKeys({});
var testReflectPreventExtensions = Reflect.preventExtensions({});
var testReflectSet = Reflect.set({}, "", 0);
var testReflectSetPrototypeOf = Reflect.setPrototypeOf({}, {});
var testArrayFind = [""].find(function (val, idx, obj) {
return true;
});
var testArrayFindIndex = [""].findIndex(function (val, idx, obj) {
return true;
});
var testArrayFill = [""].fill("fill");
var testArrayCopyWithin = [""].copyWithin(0, 0);
var testArrayEntries = [""].entries();
var testArrayKeys = [""].keys();
var testArrayValues = [""].values();
var testArrayConstructorFrom = Array.from([]);
var testArrayConstructorOf = Array.of([]);
var testObjectConstructorAssign = Object.assign({}, {});
var testObjectConstructorGetOwnPropertySymbols = Object.getOwnPropertySymbols({});
var testObjectConstructorKeys = Object.keys({});
var testObjectConstructorIs = Object.is({}, {});
var testObjectConstructorSetPrototypeOf = Object.setPrototypeOf({}, {});
var testNumberConstructorIsFinite = Number.isFinite(0);
var testNumberConstructorIsInteger = Number.isInteger(0);
var testNumberConstructorIsNan = Number.isNaN(0);
var testNumberConstructorIsSafeInteger = Number.isSafeInteger(0);
var testNumberConstructorParseFloat = Number.parseFloat("0");
var testNumberConstructorParseInt = Number.parseInt("0");
var testMathClz32 = Math.clz32(0);
var testMathImul = Math.imul(0, 0);
var testMathSign = Math.sign(0);
var testMathLog10 = Math.log10(0);
var testMathLog2 = Math.log2(0);
var testMathLog1p = Math.log1p(0);
var testMathExpm1 = Math.expm1(0);
var testMathCosh = Math.cosh(0);
var testMathSinh = Math.sinh(0);
var testMathTanh = Math.tanh(0);
var testMathAcosh = Math.acosh(0);
var testMathAsinh = Math.asinh(0);
var testMathAtanh = Math.atanh(0);
var testMathHypot = Math.hypot(0, 0);
var testMathTrunc = Math.trunc(0);
var testMathFround = Math.fround(0);
var testMathCbrt = Math.cbrt(0);
var testMap = null;
var testSet = null;
var testPromiseAll = Promise.all([]);
var testPromiseRace = Promise.race([]);
var testPromiseResolve = Promise.resolve();
var testPromiseReject = Promise.reject();
var testSymbolFor = Symbol["for"]('a');
var testSymbolKeyFor = Symbol.keyFor(testSymbolFor);
var testWeakMap = null;
var testWeakSet = null;
var testIterator = null;
var testAsyncIterator = null;
var testStringCodePointAt = "".codePointAt(0);
var testStringIncludes = "".includes("");
var testStringEndsWith = "".endsWith("");
var testStringNormalize = "".normalize();
var testStringRepeat = "".repeat(0);
var testStringStartsWith = "".startsWith("");
var testStringAnchor = "".anchor("");
var testStringBig = "".big();
var testStringBlink = "".blink();
var testStringBold = "".bold();
var testStringFixed = "".fixed();
var testStringFontColor = "".fontcolor("blue");
var testStringFontSize = "".fontsize(0);
var testStringItalics = "".italics();
var testStringLink = "".link("");
var testStringSmall = "".small();
var testStringStrike = "".strike();
var testStringSub = "".sub();
var testStringSup = "".sup();
var testStringConstructorFromCodePoint = String.fromCodePoint();
var testStringConstructorRaw = String.raw(__makeTemplateObject([""], [""]));
var testRegExpFlags = /abc/g.flags;
var testRegExpSticky = /abc/g.sticky;
var testRegExpUnicode = /abc/g.unicode;