Skip to content

Commit f89e695

Browse files
Correct some incorrectly-added declare in functions.
1 parent 13ec6c8 commit f89e695

8 files changed

+21
-21
lines changed

tests/cases/compiler/callSignaturesShouldBeResolvedBeforeSpecialization.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ interface I1<T> {
44
}
55

66
function foo() {
7-
declare var test: I1<string>;
7+
var test!: I1<string>;
88
test("expects boolean instead of string"); // should not error - "test" should not expect a boolean
99
test(true); // should error - string expected
1010
}

tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class Chain<T> {
22
constructor(public value: T) { }
33
then<S extends T>(cb: (x: T) => S): Chain<S> {
4-
declare var t: T;
5-
declare var s: S;
4+
var t!: T;
5+
var s!: S;
66
// Ok to go down the chain, but error to climb up the chain
77
(new Chain(t)).then(tt => s).then(ss => t);
88

@@ -24,9 +24,9 @@ interface I {
2424
class Chain2<T extends I> {
2525
constructor(public value: T) { }
2626
then<S extends T>(cb: (x: T) => S): Chain2<S> {
27-
declare var i: I;
28-
declare var t: T;
29-
declare var s: S;
27+
var i!: I;
28+
var t!: T;
29+
var s!: S;
3030
// Ok to go down the chain, check the constraint at the end.
3131
// Should get an error that we are assigning a string to a number
3232
(new Chain2(i)).then(ii => t).then(tt => s).value.x = "";

tests/cases/compiler/exportSpecifierForAGlobal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ declare class X { }
77
// @filename: b.ts
88
export {X};
99
export function f() {
10-
declare var x: X;
10+
var x!: X;
1111
return x;
1212
}

tests/cases/compiler/genericConstructorFunction1.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function f1<T>(args: T) {
2-
declare var v1: { [index: string]: new (arg: T) => Date };
2+
var v1!: { [index: string]: new (arg: T) => Date };
33
var v2 = v1['test'];
44
v2(args);
55
return new v2(args); // used to give error
@@ -8,7 +8,7 @@ function f1<T>(args: T) {
88

99
interface I1<T> { new (arg: T): Date };
1010
function f2<T>(args: T) {
11-
declare var v1: { [index: string]: I1<T> };
11+
var v1!: { [index: string]: I1<T> };
1212
var v2 = v1['test'];
1313
var y = v2(args);
1414
return new v2(args); // used to give error

tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ namespace Generics {
2727
}
2828

2929
function foo<T extends Base>() {
30-
declare var a: A<T>;
31-
declare var b: { [x: number]: Derived; }
30+
var a!: A<T>;
31+
var b!: { [x: number]: Derived; }
3232
a = b; // error
3333
b = a; // error
3434

35-
declare var b2: { [x: number]: Derived2; }
35+
var b2!: { [x: number]: Derived2; }
3636
a = b2; // error
3737
b2 = a; // error
3838

39-
declare var b3: { [x: number]: T; }
39+
var b3!: { [x: number]: T; }
4040
a = b3; // ok
4141
b3 = a; // ok
4242
}

tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer3.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ namespace Generics {
2828
}
2929

3030
function foo<T extends Derived>() {
31-
declare var a: A<T>;
32-
declare var b: { [x: number]: Derived; };
31+
var a!: A<T>;
32+
var b!: { [x: number]: Derived; };
3333
a = b; // error
3434
b = a; // ok
3535

36-
declare var b2: { [x: number]: T; };
36+
var b2!: { [x: number]: T; };
3737
a = b2; // ok
3838
b2 = a; // ok
3939
}

tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ namespace Generics {
4141
b2 = a1; // error
4242

4343
function foo<T extends Base>() {
44-
declare var b3: { [x: string]: Derived; };
45-
declare var a3: A<T>;
44+
var b3!: { [x: string]: Derived; };
45+
var a3!: A<T>;
4646
a3 = b3; // error
4747
b3 = a3; // error
4848

49-
declare var b4: { [x: string]: Derived2; };
49+
var b4!: { [x: string]: Derived2; };
5050
a3 = b4; // error
5151
b4 = a3; // error
5252
}

tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer3.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ namespace Generics {
1515
}
1616

1717
function foo<T extends Derived>() {
18-
declare var a: A<T>;
19-
declare var b: { [x: string]: string; };
18+
var a!: A<T>;
19+
var b!: { [x: string]: string; };
2020
a = b; // error
2121
b = a; // error
2222
}

0 commit comments

Comments
 (0)