Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(7411): Add additional test cases #53809

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tests/baselines/reference/jsxElementType.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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<T, {}>'.
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) ====
/// <reference path="/.lib/react16.d.ts" />
import * as React from "react";

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

<a:b a="accepted" />;
<a:b b="rejected" />;
~
!!! error TS2322: Type '{ b: string; }' is not assignable to type '{ a: string; }'.
!!! error TS2322: Property 'b' does not exist on type '{ a: string; }'.
<a:b a="accepted" b="rejected" />;
~
!!! error TS2322: Type '{ a: string; b: string; }' is not assignable to type '{ a: string; }'.
Expand Down
4 changes: 4 additions & 0 deletions tests/baselines/reference/jsxElementType.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ declare global {
}
}

<a:b a="accepted" />;
<a:b b="rejected" />;
<a:b a="accepted" b="rejected" />;


Expand Down Expand Up @@ -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" });
10 changes: 8 additions & 2 deletions tests/baselines/reference/jsxElementType.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,13 @@ declare global {
}
}

<a:b a="accepted" b="rejected" />;
<a:b a="accepted" />;
>a : Symbol(a, Decl(jsxElementType.tsx, 108, 4))
>b : Symbol(b, Decl(jsxElementType.tsx, 108, 17))

<a:b b="rejected" />;
>b : Symbol(b, Decl(jsxElementType.tsx, 109, 4))

<a:b a="accepted" b="rejected" />;
>a : Symbol(a, Decl(jsxElementType.tsx, 110, 4))
>b : Symbol(b, Decl(jsxElementType.tsx, 110, 17))

12 changes: 12 additions & 0 deletions tests/baselines/reference/jsxElementType.types
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,18 @@ declare global {
}
}

<a:b a="accepted" />;
><a:b a="accepted" /> : JSX.Element
>a : any
>b : any
>a : string

<a:b b="rejected" />;
><a:b b="rejected" /> : JSX.Element
>a : any
>b : any
>b : string

<a:b a="accepted" b="rejected" />;
><a:b a="accepted" b="rejected" /> : JSX.Element
>a : any
Expand Down
2 changes: 2 additions & 0 deletions tests/cases/compiler/jsxElementType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,6 @@ declare global {
}
}

<a:b a="accepted" />;
<a:b b="rejected" />;
<a:b a="accepted" b="rejected" />;