From 020ce0c08c8d9469e18a806055d1c01b3001a146 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Mon, 17 Apr 2023 19:44:34 +0300 Subject: [PATCH] feat(7411): Add additional test cases (#53809) --- tests/baselines/reference/jsxElementType.errors.txt | 11 +++++++++-- tests/baselines/reference/jsxElementType.js | 4 ++++ tests/baselines/reference/jsxElementType.symbols | 10 ++++++++-- tests/baselines/reference/jsxElementType.types | 12 ++++++++++++ tests/cases/compiler/jsxElementType.tsx | 2 ++ 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/tests/baselines/reference/jsxElementType.errors.txt b/tests/baselines/reference/jsxElementType.errors.txt index f9a7859467417..1689e535546c1 100644 --- a/tests/baselines/reference/jsxElementType.errors.txt +++ b/tests/baselines/reference/jsxElementType.errors.txt @@ -34,11 +34,13 @@ tests/cases/compiler/jsxElementType.tsx(91,2): error TS2786: 'ReactNativeFlatLis tests/cases/compiler/jsxElementType.tsx(95,11): error TS2322: Type '{}' is not assignable to type 'LibraryManagedAttributes'. tests/cases/compiler/jsxElementType.tsx(98,2): error TS2304: Cannot find name 'Unresolved'. tests/cases/compiler/jsxElementType.tsx(99,2): error TS2304: Cannot find name 'Unresolved'. -tests/cases/compiler/jsxElementType.tsx(109,19): error TS2322: Type '{ a: string; b: string; }' is not assignable to type '{ a: string; }'. +tests/cases/compiler/jsxElementType.tsx(110,6): error TS2322: Type '{ b: string; }' is not assignable to type '{ a: string; }'. + Property 'b' does not exist on type '{ a: string; }'. +tests/cases/compiler/jsxElementType.tsx(111,19): error TS2322: Type '{ a: string; b: string; }' is not assignable to type '{ a: string; }'. Property 'b' does not exist on type '{ a: string; }'. -==== tests/cases/compiler/jsxElementType.tsx (19 errors) ==== +==== tests/cases/compiler/jsxElementType.tsx (20 errors) ==== /// import * as React from "react"; @@ -208,6 +210,11 @@ tests/cases/compiler/jsxElementType.tsx(109,19): error TS2322: Type '{ a: string } } + ; + ; + ~ +!!! error TS2322: Type '{ b: string; }' is not assignable to type '{ a: string; }'. +!!! error TS2322: Property 'b' does not exist on type '{ a: string; }'. ; ~ !!! error TS2322: Type '{ a: string; b: string; }' is not assignable to type '{ a: string; }'. diff --git a/tests/baselines/reference/jsxElementType.js b/tests/baselines/reference/jsxElementType.js index 6d33af33a2a86..ac207922f5fb3 100644 --- a/tests/baselines/reference/jsxElementType.js +++ b/tests/baselines/reference/jsxElementType.js @@ -107,6 +107,8 @@ declare global { } } +; +; ; @@ -241,4 +243,6 @@ function f1(Component) { } React.createElement(Unresolved, null); React.createElement(Unresolved, { foo: "abc" }); +React.createElement("a:b", { a: "accepted" }); +React.createElement("a:b", { b: "rejected" }); React.createElement("a:b", { a: "accepted", b: "rejected" }); diff --git a/tests/baselines/reference/jsxElementType.symbols b/tests/baselines/reference/jsxElementType.symbols index d484bc27ba8f7..f7862688c0a46 100644 --- a/tests/baselines/reference/jsxElementType.symbols +++ b/tests/baselines/reference/jsxElementType.symbols @@ -289,7 +289,13 @@ declare global { } } -; +; >a : Symbol(a, Decl(jsxElementType.tsx, 108, 4)) ->b : Symbol(b, Decl(jsxElementType.tsx, 108, 17)) + +; +>b : Symbol(b, Decl(jsxElementType.tsx, 109, 4)) + +; +>a : Symbol(a, Decl(jsxElementType.tsx, 110, 4)) +>b : Symbol(b, Decl(jsxElementType.tsx, 110, 17)) diff --git a/tests/baselines/reference/jsxElementType.types b/tests/baselines/reference/jsxElementType.types index c40216ea86285..c9064857cdbbb 100644 --- a/tests/baselines/reference/jsxElementType.types +++ b/tests/baselines/reference/jsxElementType.types @@ -303,6 +303,18 @@ declare global { } } +; +> : JSX.Element +>a : any +>b : any +>a : string + +; +> : JSX.Element +>a : any +>b : any +>b : string + ; > : JSX.Element >a : any diff --git a/tests/cases/compiler/jsxElementType.tsx b/tests/cases/compiler/jsxElementType.tsx index 37713a05fea59..f0028b1ed6e3f 100644 --- a/tests/cases/compiler/jsxElementType.tsx +++ b/tests/cases/compiler/jsxElementType.tsx @@ -108,4 +108,6 @@ declare global { } } +; +; ;