Skip to content

Commit f2190c4

Browse files
committed
Use different, specific types for helper variables
Also add some comments.
1 parent 63af658 commit f2190c4

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

tests/baselines/reference/typeAliasDeclareKeywordNewlines.errors.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ typeAliasDeclareKeywordNewlines.ts(5,1): error TS1142: Line break not permitted
22

33

44
==== typeAliasDeclareKeywordNewlines.ts (1 errors) ====
5-
var declare: any, type: any;
5+
var declare: string, type: number;
66

77
// The following is invalid but should declare a type alias named 'T1':
88
declare type /*unexpected newline*/
99
T1 = null;
1010
~~
1111
!!! error TS1142: Line break not permitted here.
12-
const t1: T1 = null;
12+
const t1: T1 = null; // Assert that T1 is the null type.
1313

1414
let T: null;
1515
// The following should use a variable named 'declare', use a variable named
@@ -22,5 +22,5 @@ typeAliasDeclareKeywordNewlines.ts(5,1): error TS1142: Line break not permitted
2222
// named 'T2':
2323
declare /*ASI*/
2424
type T2 = null;
25-
const t2: T2 = null;
25+
const t2: T2 = null; // Assert that T2 is the null type.
2626

tests/baselines/reference/typeAliasDeclareKeywordNewlines.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//// [tests/cases/compiler/typeAliasDeclareKeywordNewlines.ts] ////
22

33
//// [typeAliasDeclareKeywordNewlines.ts]
4-
var declare: any, type: any;
4+
var declare: string, type: number;
55

66
// The following is invalid but should declare a type alias named 'T1':
77
declare type /*unexpected newline*/
88
T1 = null;
9-
const t1: T1 = null;
9+
const t1: T1 = null; // Assert that T1 is the null type.
1010

1111
let T: null;
1212
// The following should use a variable named 'declare', use a variable named
@@ -19,12 +19,12 @@ T = null;
1919
// named 'T2':
2020
declare /*ASI*/
2121
type T2 = null;
22-
const t2: T2 = null;
22+
const t2: T2 = null; // Assert that T2 is the null type.
2323

2424

2525
//// [typeAliasDeclareKeywordNewlines.js]
2626
var declare, type;
27-
var t1 = null;
27+
var t1 = null; // Assert that T1 is the null type.
2828
var T;
2929
// The following should use a variable named 'declare', use a variable named
3030
// 'type', and assign to a variable named 'T'.
@@ -34,4 +34,4 @@ T = null;
3434
// The following should use a variable named 'declare' and declare a type alias
3535
// named 'T2':
3636
declare; /*ASI*/
37-
var t2 = null;
37+
var t2 = null; // Assert that T2 is the null type.

tests/baselines/reference/typeAliasDeclareKeywordNewlines.symbols

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
//// [tests/cases/compiler/typeAliasDeclareKeywordNewlines.ts] ////
22

33
=== typeAliasDeclareKeywordNewlines.ts ===
4-
var declare: any, type: any;
4+
var declare: string, type: number;
55
>declare : Symbol(declare, Decl(typeAliasDeclareKeywordNewlines.ts, 0, 3))
6-
>type : Symbol(type, Decl(typeAliasDeclareKeywordNewlines.ts, 0, 17))
6+
>type : Symbol(type, Decl(typeAliasDeclareKeywordNewlines.ts, 0, 20))
77

88
// The following is invalid but should declare a type alias named 'T1':
99
declare type /*unexpected newline*/
1010
T1 = null;
11-
>T1 : Symbol(T1, Decl(typeAliasDeclareKeywordNewlines.ts, 0, 28))
11+
>T1 : Symbol(T1, Decl(typeAliasDeclareKeywordNewlines.ts, 0, 34))
1212

13-
const t1: T1 = null;
13+
const t1: T1 = null; // Assert that T1 is the null type.
1414
>t1 : Symbol(t1, Decl(typeAliasDeclareKeywordNewlines.ts, 5, 5))
15-
>T1 : Symbol(T1, Decl(typeAliasDeclareKeywordNewlines.ts, 0, 28))
15+
>T1 : Symbol(T1, Decl(typeAliasDeclareKeywordNewlines.ts, 0, 34))
1616

1717
let T: null;
1818
>T : Symbol(T, Decl(typeAliasDeclareKeywordNewlines.ts, 7, 3))
@@ -23,7 +23,7 @@ declare /*ASI*/
2323
>declare : Symbol(declare, Decl(typeAliasDeclareKeywordNewlines.ts, 0, 3))
2424

2525
type /*ASI*/
26-
>type : Symbol(type, Decl(typeAliasDeclareKeywordNewlines.ts, 0, 17))
26+
>type : Symbol(type, Decl(typeAliasDeclareKeywordNewlines.ts, 0, 20))
2727

2828
T = null;
2929
>T : Symbol(T, Decl(typeAliasDeclareKeywordNewlines.ts, 7, 3))
@@ -36,7 +36,7 @@ declare /*ASI*/
3636
type T2 = null;
3737
>T2 : Symbol(T2, Decl(typeAliasDeclareKeywordNewlines.ts, 16, 7))
3838

39-
const t2: T2 = null;
39+
const t2: T2 = null; // Assert that T2 is the null type.
4040
>t2 : Symbol(t2, Decl(typeAliasDeclareKeywordNewlines.ts, 18, 5))
4141
>T2 : Symbol(T2, Decl(typeAliasDeclareKeywordNewlines.ts, 16, 7))
4242

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
//// [tests/cases/compiler/typeAliasDeclareKeywordNewlines.ts] ////
22

33
=== typeAliasDeclareKeywordNewlines.ts ===
4-
var declare: any, type: any;
5-
>declare : any
6-
>type : any
4+
var declare: string, type: number;
5+
>declare : string
6+
>type : number
77

88
// The following is invalid but should declare a type alias named 'T1':
99
declare type /*unexpected newline*/
1010
T1 = null;
1111
>T1 : null
1212

13-
const t1: T1 = null;
13+
const t1: T1 = null; // Assert that T1 is the null type.
1414
>t1 : null
1515

1616
let T: null;
@@ -19,10 +19,10 @@ let T: null;
1919
// The following should use a variable named 'declare', use a variable named
2020
// 'type', and assign to a variable named 'T'.
2121
declare /*ASI*/
22-
>declare : any
22+
>declare : string
2323

2424
type /*ASI*/
25-
>type : any
25+
>type : number
2626

2727
T = null;
2828
>T = null : null
@@ -31,11 +31,11 @@ T = null;
3131
// The following should use a variable named 'declare' and declare a type alias
3232
// named 'T2':
3333
declare /*ASI*/
34-
>declare : any
34+
>declare : string
3535

3636
type T2 = null;
3737
>T2 : null
3838

39-
const t2: T2 = null;
39+
const t2: T2 = null; // Assert that T2 is the null type.
4040
>t2 : null
4141

tests/cases/compiler/typeAliasDeclareKeywordNewlines.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
var declare: any, type: any;
1+
var declare: string, type: number;
22

33
// The following is invalid but should declare a type alias named 'T1':
44
declare type /*unexpected newline*/
55
T1 = null;
6-
const t1: T1 = null;
6+
const t1: T1 = null; // Assert that T1 is the null type.
77

88
let T: null;
99
// The following should use a variable named 'declare', use a variable named
@@ -16,4 +16,4 @@ T = null;
1616
// named 'T2':
1717
declare /*ASI*/
1818
type T2 = null;
19-
const t2: T2 = null;
19+
const t2: T2 = null; // Assert that T2 is the null type.

0 commit comments

Comments
 (0)