Skip to content

Commit c705d8c

Browse files
committed
Make test clearer
1 parent a188cca commit c705d8c

9 files changed

+45
-12
lines changed
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
//// [index.tsx]
2+
declare const React: any;
3+
24
export function Foo() {
5+
// No error; "const" is lowercase and therefore intrinsic.
36
return <const T extends/>
47
}
58

69

7-
//// [index.jsx]
10+
//// [index.js]
811
"use strict";
912
Object.defineProperty(exports, "__esModule", { value: true });
1013
exports.Foo = void 0;
1114
function Foo() {
12-
return <const T extends/>;
15+
// No error; "const" is lowercase and therefore intrinsic.
16+
return React.createElement("const", { T: true, extends: true });
1317
}
1418
exports.Foo = Foo;
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
=== tests/cases/compiler/index.tsx ===
2+
declare const React: any;
3+
>React : Symbol(React, Decl(index.tsx, 0, 13))
4+
25
export function Foo() {
3-
>Foo : Symbol(Foo, Decl(index.tsx, 0, 0))
6+
>Foo : Symbol(Foo, Decl(index.tsx, 0, 25))
47

8+
// No error; "const" is lowercase and therefore intrinsic.
59
return <const T extends/>
6-
>T : Symbol(T, Decl(index.tsx, 1, 17))
7-
>extends : Symbol(extends, Decl(index.tsx, 1, 19))
10+
>T : Symbol(T, Decl(index.tsx, 4, 17))
11+
>extends : Symbol(extends, Decl(index.tsx, 4, 19))
812
}
913

tests/baselines/reference/parseJsxExtends1.types

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
=== tests/cases/compiler/index.tsx ===
2+
declare const React: any;
3+
>React : any
4+
25
export function Foo() {
36
>Foo : () => any
47

8+
// No error; "const" is lowercase and therefore intrinsic.
59
return <const T extends/>
610
><const T extends/> : error
711
>const : any

tests/baselines/reference/parseJsxExtends2.errors.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
tests/cases/compiler/index.tsx(2,13): error TS2304: Cannot find name 'T'.
1+
tests/cases/compiler/index.tsx(5,13): error TS2304: Cannot find name 'T'.
22

33

44
==== tests/cases/compiler/index.tsx (1 errors) ====
5+
declare const React: any;
6+
57
export function Foo() {
8+
// Error: T is not declared.
69
return <T extends/>
710
~
811
!!! error TS2304: Cannot find name 'T'.
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
//// [index.tsx]
2+
declare const React: any;
3+
24
export function Foo() {
5+
// Error: T is not declared.
36
return <T extends/>
47
}
58

69

7-
//// [index.jsx]
10+
//// [index.js]
811
"use strict";
912
Object.defineProperty(exports, "__esModule", { value: true });
1013
exports.Foo = void 0;
1114
function Foo() {
12-
return <T extends/>;
15+
// Error: T is not declared.
16+
return React.createElement(T, { extends: true });
1317
}
1418
exports.Foo = Foo;
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
=== tests/cases/compiler/index.tsx ===
2+
declare const React: any;
3+
>React : Symbol(React, Decl(index.tsx, 0, 13))
4+
25
export function Foo() {
3-
>Foo : Symbol(Foo, Decl(index.tsx, 0, 0))
6+
>Foo : Symbol(Foo, Decl(index.tsx, 0, 25))
47

8+
// Error: T is not declared.
59
return <T extends/>
6-
>extends : Symbol(extends, Decl(index.tsx, 1, 13))
10+
>extends : Symbol(extends, Decl(index.tsx, 4, 13))
711
}
812

tests/baselines/reference/parseJsxExtends2.types

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
=== tests/cases/compiler/index.tsx ===
2+
declare const React: any;
3+
>React : any
4+
25
export function Foo() {
36
>Foo : () => any
47

8+
// Error: T is not declared.
59
return <T extends/>
610
><T extends/> : any
711
>T : any
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
// @jsx: preserve
1+
// @jsx: react
22
// @filename: index.tsx
33

4+
declare const React: any;
5+
46
export function Foo() {
7+
// No error; "const" is lowercase and therefore intrinsic.
58
return <const T extends/>
69
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
// @jsx: preserve
1+
// @jsx: react
22
// @filename: index.tsx
33

4+
declare const React: any;
5+
46
export function Foo() {
7+
// Error: T is not declared.
58
return <T extends/>
69
}

0 commit comments

Comments
 (0)