0db3038b57
1. Sort is now stable in node 11, which exposed a lack in the sorting of nested ranges. Ranges now sort based on last ending if the start positions are the same. This means nested ranges sort the containing range first, even if a range contains another range that starts at the same position. 2. Symbol has a new member description which can't be accessed through the prototype. In addition, Array now has flat and flatMap, which I excluded to keep baselines the same between Node 6-11.
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
/// <reference path="fourslash.ts" />
|
|
|
|
////dummy text
|
|
|
|
verify.generateTypes(
|
|
// would like to test against the real "global" but that may vary between node versions.
|
|
{
|
|
value: {
|
|
Array: ignore(Array, ["values", "flat", "flatMap"]),
|
|
Boolean,
|
|
Date,
|
|
Math,
|
|
Number,
|
|
RegExp,
|
|
String: ignore(String, ["padStart", "padEnd", "trimStart", "trimEnd"]),
|
|
Symbol: ignore(Symbol, ["asyncIterator", "description"]),
|
|
},
|
|
outputBaseline: "global",
|
|
},
|
|
{ value: require("lodash"), outputBaseline: "lodash" },
|
|
);
|
|
|
|
// Ignore properties only present in newer versions of node.
|
|
function ignore(Cls: Function, ignored: ReadonlyArray<string>): Function {
|
|
class Copy {}
|
|
for (const name of Object.getOwnPropertyNames(Cls)) {
|
|
if (ignored.includes(name) || name === "arguments" || name === "caller" || name === "name" || name === "length" || name === "prototype") continue;
|
|
Copy[name] = Cls[name];
|
|
}
|
|
for (const name of Object.getOwnPropertyNames(Cls.prototype)) {
|
|
if (ignored.includes(name)) continue;
|
|
Copy.prototype[name] = Cls.prototype[name];
|
|
}
|
|
return Copy;
|
|
}
|