Skip to content

Commit a211df7

Browse files
committed
add lib: es5 option on es5-dependent tests
1 parent e8778e8 commit a211df7

File tree

85 files changed

+89
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+89
-7
lines changed

Diff for: tests/cases/compiler/2dArrays.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
class Cell {
23
}
34

Diff for: tests/cases/compiler/APISample_compile.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// @includebuiltfile: typescript_standalone.d.ts
33
// @noImplicitAny:true
44
// @strictNullChecks:true
5+
// @lib: es5
56

67
/*
78
* Note: This test is a public API sample. The sample sources can be found

Diff for: tests/cases/compiler/APISample_linter.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// @includebuiltfile: typescript_standalone.d.ts
33
// @noImplicitAny:true
44
// @strictNullChecks:true
5+
// @lib: es5
56

67
/*
78
* Note: This test is a public API sample. The sample sources can be found

Diff for: tests/cases/compiler/APISample_transform.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// @includebuiltfile: typescript_standalone.d.ts
33
// @noImplicitAny:true
44
// @strictNullChecks:true
5+
// @lib: es5
56

67
/*
78
* Note: This test is a public API sample. The sample sources can be found

Diff for: tests/cases/compiler/APISample_watcher.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// @includebuiltfile: typescript_standalone.d.ts
33
// @noImplicitAny:true
44
// @strictNullChecks:true
5+
// @lib: es5
56

67
/*
78
* Note: This test is a public API sample. The sample sources can be found

Diff for: tests/cases/compiler/anyInferenceAnonymousFunctions.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
var paired: any[];
23

34
paired.reduce(function (a1, a2) {

Diff for: tests/cases/compiler/argumentsAsPropertyName.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @target: es5
12
// target: es5
23
type MyType = {
34
arguments: Array<string>

Diff for: tests/cases/compiler/arrayConcatMap.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
// @lib: es5
12
var x = [].concat([{ a: 1 }], [{ a: 2 }])
23
.map(b => b.a);

Diff for: tests/cases/compiler/arrayFilter.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
var foo = [
23
{ name: 'bar' },
34
{ name: null },

Diff for: tests/cases/compiler/assigningFromObjectToAnythingElse.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
var x: Object;
23
var y: RegExp;
34
y = x;

Diff for: tests/cases/compiler/assignmentCompat1.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
var x = { one: 1 };
23
var y: { [index: string]: any };
34
var z: { [index: number]: any };

Diff for: tests/cases/compiler/autoLift2.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
class A
23

34
{

Diff for: tests/cases/compiler/bestChoiceType.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @strictNullChecks: true
2+
// @lib: es5
23

34
// Repro from #10041
45

Diff for: tests/cases/compiler/bindingPatternInParameter01.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
const nestedArray = [[[1, 2]], [[3, 4]]];
23

34
nestedArray.forEach(([[a, b]]) => {

Diff for: tests/cases/compiler/checkSwitchStatementIfCaseTypeIsString.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
declare function use(a: any): void;
23

34
class A {

Diff for: tests/cases/compiler/classExtendsNull.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
class C extends null {
1+
// @lib: es5
2+
class C extends null {
23
constructor() {
34
super();
45
return Object.create(null);

Diff for: tests/cases/compiler/commaOperatorInConditionalExpression.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
function f (m: string) {
23
[1, 2, 3].map(i => {
34
return true? { [m]: i } : { [m]: i + 1 }

Diff for: tests/cases/compiler/commentInMethodCall.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
//commment here
23
var s: string[];
34
s.map(// do something

Diff for: tests/cases/compiler/contextualSignatureInstantiation3.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
function map<T, U>(items: T[], f: (x: T) => U): U[]{
23
return items.map(f);
34
}

Diff for: tests/cases/compiler/controlFlowDestructuringParameters.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Repro for #8376
22

33
// @strictNullChecks: true
4+
// @lib: es5
45

56
[{ x: 1 }].map(
67
({ x }) => x

Diff for: tests/cases/compiler/controlFlowPropertyDeclarations.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
// Repro from ##8913
23

34
declare var require:any;

Diff for: tests/cases/compiler/defaultIndexProps2.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
class Foo {
23
public v = "Yo";
34
}

Diff for: tests/cases/compiler/duplicateLocalVariable1.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
// @lib: es5
22
// @allowUnreachableCode: true
33
/ /@module: commonjs
44

Diff for: tests/cases/compiler/duplicateOverloadInTypeAugmentation1.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
interface Array<T> {
23
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T,
34
initialValue?: T): T;

Diff for: tests/cases/compiler/enumIndexer.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
enum MyEnumType {
23
foo, bar
34
}

Diff for: tests/cases/compiler/errorMessageOnObjectLiteralType.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
var x: {
23
a: string;
34
b: number;

Diff for: tests/cases/compiler/excessPropertyCheckWithEmptyObject.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
// Repro from #14910
23

34
// Excess property error expected here

Diff for: tests/cases/compiler/extendArray.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
var a = [1,2];
23
a.forEach(function (v,i,a) {});
34

Diff for: tests/cases/compiler/forOfTransformsExpression.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
// https://github.com./Microsoft/TypeScript/issues/11024
23
let items = [{ name: "A" }, { name: "C" }, { name: "B" }];
34
for (var item of items.sort((a, b) => a.name.localeCompare(b.name))) {

Diff for: tests/cases/compiler/genericArray1.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @declaration: true
2+
// @lib: es5
23
/*
34
var n: number[];
45
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
// @lib: es5
12
var b: number[];
23
b.reduce<number>((c, d) => c + d, 0); // should not error on '+'

Diff for: tests/cases/compiler/genericInference1.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
// @lib: es5
12
['a', 'b', 'c'].map(x => x.length);

Diff for: tests/cases/compiler/genericMethodOverspecialization.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
var names = ["list", "table1", "table2", "table3", "summary"];
23

34
interface HTMLElement {

Diff for: tests/cases/compiler/genericReduce.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
var a = ["An", "array", "of", "strings"];
23
var b = a.map(s => s.length);
34
var n1 = b.reduce((x, y) => x + y);

Diff for: tests/cases/compiler/getterSetterNonAccessor.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
function getFunc():any{return 0;}
23
function setFunc(v){}
34

Diff for: tests/cases/compiler/implementArrayInterface.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
declare class MyArray<T> implements Array<T> {
23
toString(): string;
34
toLocaleString(): string;

Diff for: tests/cases/compiler/inferentialTypingWithFunctionType2.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
function identity<A>(a: A): A {
23
return a;
34
}

Diff for: tests/cases/compiler/isArray.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
var maybeArray: number | number[];
23

34

Diff for: tests/cases/compiler/json.stringify.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @strictNullChecks: true
2+
// @lib: es5
23

34
var value = null;
45
JSON.stringify(value, undefined, 2);

Diff for: tests/cases/compiler/library_DatePrototypeProperties.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// Properties of the Date prototype object as per ES5 spec
2-
// http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.5
1+
// @lib: es5
2+
// Properties of the Date prototype object as per ES5 spec
3+
// http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.5
34
Date.prototype.constructor;
45
Date.prototype.toString();
56
Date.prototype.toDateString();

Diff for: tests/cases/compiler/mapOnTupleTypes01.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @declaration: true
22
// @noImplicitAny: true
33
// @strictNullChecks: true
4+
// @lib: es5
45

56
export let mapOnLooseArrayLiteral = [1, 2, 3, 4].map(n => n * n);
67

Diff for: tests/cases/compiler/mapOnTupleTypes02.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @declaration: true
22
// @noImplicitAny: true
33
// @strictNullChecks: true
4+
// @lib: es5
45

56
export type Point = [number, number];
67

Diff for: tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
function map<T, U>(xs: T[], f: (x: T) => U) {
23
var ys: U[] = [];
34
xs.forEach(x => ys.push(f(x)));

Diff for: tests/cases/compiler/nestedSelf.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
module M {
23
export class C {
34
public n = 42;

Diff for: tests/cases/compiler/noErrorsInCallback.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
class Bar {
23
constructor(public foo: string) { }
34
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @noimplicitany: true
2+
// @lib: es5
23

34
var regexMatchList = ['', ''];
45
regexMatchList.forEach(match => ''.replace(match, ''));

Diff for: tests/cases/compiler/objectCreate-errors.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @strictNullChecks: true
2+
// @lib: es5
23

34
var e1 = Object.create(1); // Error
45
var e2 = Object.create("string"); // Error

Diff for: tests/cases/compiler/objectCreate.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @strictNullChecks: true
2+
// @lib: es5
23

34
declare var union: null | { a: number, b: string };
45

Diff for: tests/cases/compiler/objectCreate2.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @strictNullChecks: false
2+
// @lib: es5
23

34
declare var union: null | { a: number, b: string };
45

Diff for: tests/cases/compiler/objectFreeze.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
const f = Object.freeze(function foo(a: number, b: string) { return false; });
23
f(1, "") === false;
34

Diff for: tests/cases/compiler/objectLitGetterSetter.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
var obj = {};
23
Object.defineProperty(obj, "accProperty", <PropertyDescriptor>({
34
get: function () {

Diff for: tests/cases/compiler/partiallyDiscriminantedUnions.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
// Repro from #10586
23

34
interface A1 {

Diff for: tests/cases/compiler/recursiveTypeRelations.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
// Repro from #14896
23

34
type Attributes<Keys extends string> = {

Diff for: tests/cases/compiler/restArgAssignmentCompat.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
function f(...x: number[]) {
23
x.forEach((n, i) => void ('item ' + i + ' = ' + n));
34
}

Diff for: tests/cases/compiler/returnTypeParameterWithModules.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
module M1 {
23
export function reduce<A>(ar, f, e?): Array<A> {
34
return Array.prototype.reduce.apply(ar, e ? [f, e] : [f]);
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
// @lib: es5
12
[].map(() => [].map(p => ({ X: p })));

Diff for: tests/cases/compiler/specializationsShouldNotAffectEachOther.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
// @lib: es5
22
interface Series {
33
data: string[];
44
}

Diff for: tests/cases/compiler/staticAnonymousTypeNotReferencingTypeParameter.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
// This test case is a condensed version of Angular 2's ListWrapper. Prior to #7448
23
// this would cause the compiler to run out of memory.
34

Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
// @lib: es5
12
var str: string = ""[0];

Diff for: tests/cases/compiler/superPropertyAccess.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
// @lib: es5
22
class MyBase {
33
m1(a: string) { return a; }
44
private p1() { }

Diff for: tests/cases/compiler/targetTypeArgs.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
function foo(callback: (x: string) => void) {
23
callback("hello");
34
}

Diff for: tests/cases/compiler/targetTypeObjectLiteralToAny.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
function suggest(){
23
var TypeScriptKeywords:string[];
34
var result:any;
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
class C {
23
public foo() { [1,2,3].map<any,any>((x) => { return this; })}
34
}

Diff for: tests/cases/compiler/typeArgumentInferenceWithRecursivelyReferencedTypeAliasToTypeLiteral01.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
type TreeNode = {
23
name: string;
34
parent: TreeNode;

Diff for: tests/cases/compiler/typeArgumentInferenceWithRecursivelyReferencedTypeAliasToTypeLiteral02.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
type TreeNode = {
23
name: string;
34
parent: TreeNode;

Diff for: tests/cases/compiler/undeclaredModuleError.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@module: amd
2+
// @lib: es5
23
import fs = require('fs');
34
function readdir(path: string, accept: (stat: fs.Stats, name: string) => boolean, callback: (error: Error, results: { name: string; stat: fs.Stats; }[]) => void ) {}
45

Diff for: tests/cases/compiler/unknownSymbolOffContextualType1.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
declare var document: Document;
23
interface Document {
34
getElementById(elementId: string): HTMLElement;

Diff for: tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInInstanceMember.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
class C {
23
x = this;
34
foo() {

Diff for: tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInInstanceMember2.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
class C<T> {
23
x = this;
34
foo() {

Diff for: tests/cases/conformance/controlFlow/controlFlowIfStatement.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @allowUnreachableCode: true
2+
// @lib: es5
23

34
let x: string | number | boolean | RegExp;
45
let cond: boolean;

Diff for: tests/cases/conformance/expressions/commaOperator/commaOperatorWithSecondOperandNumberType.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @allowUnreachableCode: true
2+
// @lib: es5
23

34
var ANY: any;
45
var BOOLEAN: boolean;

Diff for: tests/cases/conformance/expressions/functions/contextuallyTypedIife.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @lib: es5
12
// arrow
23
(jake => { })("build");
34
// function expression

0 commit comments

Comments
 (0)