Skip to content

Commit 020ce0c

Browse files
authored
feat(7411): Add additional test cases (#53809)
1 parent 430c5be commit 020ce0c

File tree

5 files changed

+35
-4
lines changed

5 files changed

+35
-4
lines changed

tests/baselines/reference/jsxElementType.errors.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ tests/cases/compiler/jsxElementType.tsx(91,2): error TS2786: 'ReactNativeFlatLis
3434
tests/cases/compiler/jsxElementType.tsx(95,11): error TS2322: Type '{}' is not assignable to type 'LibraryManagedAttributes<T, {}>'.
3535
tests/cases/compiler/jsxElementType.tsx(98,2): error TS2304: Cannot find name 'Unresolved'.
3636
tests/cases/compiler/jsxElementType.tsx(99,2): error TS2304: Cannot find name 'Unresolved'.
37-
tests/cases/compiler/jsxElementType.tsx(109,19): error TS2322: Type '{ a: string; b: string; }' is not assignable to type '{ a: string; }'.
37+
tests/cases/compiler/jsxElementType.tsx(110,6): error TS2322: Type '{ b: string; }' is not assignable to type '{ a: string; }'.
38+
Property 'b' does not exist on type '{ a: string; }'.
39+
tests/cases/compiler/jsxElementType.tsx(111,19): error TS2322: Type '{ a: string; b: string; }' is not assignable to type '{ a: string; }'.
3840
Property 'b' does not exist on type '{ a: string; }'.
3941

4042

41-
==== tests/cases/compiler/jsxElementType.tsx (19 errors) ====
43+
==== tests/cases/compiler/jsxElementType.tsx (20 errors) ====
4244
/// <reference path="/.lib/react16.d.ts" />
4345
import * as React from "react";
4446

@@ -208,6 +210,11 @@ tests/cases/compiler/jsxElementType.tsx(109,19): error TS2322: Type '{ a: string
208210
}
209211
}
210212

213+
<a:b a="accepted" />;
214+
<a:b b="rejected" />;
215+
~
216+
!!! error TS2322: Type '{ b: string; }' is not assignable to type '{ a: string; }'.
217+
!!! error TS2322: Property 'b' does not exist on type '{ a: string; }'.
211218
<a:b a="accepted" b="rejected" />;
212219
~
213220
!!! error TS2322: Type '{ a: string; b: string; }' is not assignable to type '{ a: string; }'.

tests/baselines/reference/jsxElementType.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ declare global {
107107
}
108108
}
109109

110+
<a:b a="accepted" />;
111+
<a:b b="rejected" />;
110112
<a:b a="accepted" b="rejected" />;
111113

112114

@@ -241,4 +243,6 @@ function f1(Component) {
241243
}
242244
React.createElement(Unresolved, null);
243245
React.createElement(Unresolved, { foo: "abc" });
246+
React.createElement("a:b", { a: "accepted" });
247+
React.createElement("a:b", { b: "rejected" });
244248
React.createElement("a:b", { a: "accepted", b: "rejected" });

tests/baselines/reference/jsxElementType.symbols

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,13 @@ declare global {
289289
}
290290
}
291291

292-
<a:b a="accepted" b="rejected" />;
292+
<a:b a="accepted" />;
293293
>a : Symbol(a, Decl(jsxElementType.tsx, 108, 4))
294-
>b : Symbol(b, Decl(jsxElementType.tsx, 108, 17))
294+
295+
<a:b b="rejected" />;
296+
>b : Symbol(b, Decl(jsxElementType.tsx, 109, 4))
297+
298+
<a:b a="accepted" b="rejected" />;
299+
>a : Symbol(a, Decl(jsxElementType.tsx, 110, 4))
300+
>b : Symbol(b, Decl(jsxElementType.tsx, 110, 17))
295301

tests/baselines/reference/jsxElementType.types

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,18 @@ declare global {
303303
}
304304
}
305305

306+
<a:b a="accepted" />;
307+
><a:b a="accepted" /> : JSX.Element
308+
>a : any
309+
>b : any
310+
>a : string
311+
312+
<a:b b="rejected" />;
313+
><a:b b="rejected" /> : JSX.Element
314+
>a : any
315+
>b : any
316+
>b : string
317+
306318
<a:b a="accepted" b="rejected" />;
307319
><a:b a="accepted" b="rejected" /> : JSX.Element
308320
>a : any

tests/cases/compiler/jsxElementType.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,6 @@ declare global {
108108
}
109109
}
110110

111+
<a:b a="accepted" />;
112+
<a:b b="rejected" />;
111113
<a:b a="accepted" b="rejected" />;

0 commit comments

Comments
 (0)