Skip to content

Commit c159cfa

Browse files
Copilotjakebailey
andcommitted
Fix jsx-runtime test by adding React types reference
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
1 parent 5398b28 commit c159cfa

File tree

5 files changed

+41
-36
lines changed

5 files changed

+41
-36
lines changed

testdata/baselines/reference/compiler/jsxRuntimeDeclarationEmit.errors.txt

Lines changed: 0 additions & 24 deletions
This file was deleted.

testdata/baselines/reference/compiler/jsxRuntimeDeclarationEmit.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
// Test case to reproduce jsx-runtime declaration emit issue
55

66

7+
/// <reference path="/.lib/react16.d.ts" />
8+
79
// This should trigger the jsx-runtime import without type annotation error
810

911
export const FunctionComponent = () => {
@@ -19,5 +21,24 @@ export const AnotherComponent = () => {
1921
//// [jsxRuntimeDeclarationEmit.d.ts]
2022
// Test case to reproduce jsx-runtime declaration emit issue
2123
// This should trigger the jsx-runtime import without type annotation error
22-
export declare const FunctionComponent: () => any;
23-
export declare const AnotherComponent: () => any;
24+
export declare const FunctionComponent: () => JSX.Element;
25+
export declare const AnotherComponent: () => JSX.Element;
26+
27+
28+
//// [DtsFileErrors]
29+
30+
31+
jsxRuntimeDeclarationEmit.d.ts(3,47): error TS2503: Cannot find namespace 'JSX'.
32+
jsxRuntimeDeclarationEmit.d.ts(4,46): error TS2503: Cannot find namespace 'JSX'.
33+
34+
35+
==== jsxRuntimeDeclarationEmit.d.ts (2 errors) ====
36+
// Test case to reproduce jsx-runtime declaration emit issue
37+
// This should trigger the jsx-runtime import without type annotation error
38+
export declare const FunctionComponent: () => JSX.Element;
39+
~~~
40+
!!! error TS2503: Cannot find namespace 'JSX'.
41+
export declare const AnotherComponent: () => JSX.Element;
42+
~~~
43+
!!! error TS2503: Cannot find namespace 'JSX'.
44+

testdata/baselines/reference/compiler/jsxRuntimeDeclarationEmit.symbols

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@
44
// Test case to reproduce jsx-runtime declaration emit issue
55

66

7+
/// <reference path="react16.d.ts" />
8+
79
// This should trigger the jsx-runtime import without type annotation error
810

911
export const FunctionComponent = () => {
10-
>FunctionComponent : Symbol(FunctionComponent, Decl(jsxRuntimeDeclarationEmit.tsx, 5, 12))
12+
>FunctionComponent : Symbol(FunctionComponent, Decl(jsxRuntimeDeclarationEmit.tsx, 7, 12))
1113

1214
return <div>Hello World</div>
15+
>div : Symbol(div, Decl(react16.d.ts, 2546, 114))
16+
>div : Symbol(div, Decl(react16.d.ts, 2546, 114))
1317
}
1418

1519
export const AnotherComponent = () => {
16-
>AnotherComponent : Symbol(AnotherComponent, Decl(jsxRuntimeDeclarationEmit.tsx, 9, 12))
20+
>AnotherComponent : Symbol(AnotherComponent, Decl(jsxRuntimeDeclarationEmit.tsx, 11, 12))
1721

1822
return <FunctionComponent />
19-
>FunctionComponent : Symbol(FunctionComponent, Decl(jsxRuntimeDeclarationEmit.tsx, 5, 12))
23+
>FunctionComponent : Symbol(FunctionComponent, Decl(jsxRuntimeDeclarationEmit.tsx, 7, 12))
2024
}

testdata/baselines/reference/compiler/jsxRuntimeDeclarationEmit.types

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,25 @@
44
// Test case to reproduce jsx-runtime declaration emit issue
55

66

7+
/// <reference path="react16.d.ts" />
8+
79
// This should trigger the jsx-runtime import without type annotation error
810

911
export const FunctionComponent = () => {
10-
>FunctionComponent : () => any
11-
>() => { return <div>Hello World</div>} : () => any
12+
>FunctionComponent : () => JSX.Element
13+
>() => { return <div>Hello World</div>} : () => JSX.Element
1214

1315
return <div>Hello World</div>
14-
><div>Hello World</div> : any
16+
><div>Hello World</div> : JSX.Element
1517
>div : any
1618
>div : any
1719
}
1820

1921
export const AnotherComponent = () => {
20-
>AnotherComponent : () => any
21-
>() => { return <FunctionComponent />} : () => any
22+
>AnotherComponent : () => JSX.Element
23+
>() => { return <FunctionComponent />} : () => JSX.Element
2224

2325
return <FunctionComponent />
24-
><FunctionComponent /> : any
25-
>FunctionComponent : () => any
26+
><FunctionComponent /> : JSX.Element
27+
>FunctionComponent : () => JSX.Element
2628
}

testdata/tests/cases/compiler/jsxRuntimeDeclarationEmit.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
// @target: esnext
88
// @module: esnext
99

10+
/// <reference path="/.lib/react16.d.ts" />
11+
1012
// This should trigger the jsx-runtime import without type annotation error
1113

1214
export const FunctionComponent = () => {

0 commit comments

Comments
 (0)