🤖 Pick PR #53784 ([test] Intrinsics with colon no lon...) into revert-47356-feat/7411 (#53793)

Co-authored-by: eps1lon <silbermann.sebastian@gmail.com>
This commit is contained in:
TypeScript Bot
2023-04-15 14:27:30 -07:00
committed by GitHub
parent fc1beb0b30
commit a674d0b335
5 changed files with 80 additions and 3 deletions

View File

@@ -197,4 +197,15 @@ tests/cases/compiler/jsxElementType.tsx(99,2): error TS2304: Cannot find name 'U
<Unresolved foo="abc" />;
~~~~~~~~~~
!!! error TS2304: Cannot find name 'Unresolved'.
// regression test for intrinsic containing `:`
declare global {
namespace JSX {
interface IntrinsicElements {
['fbt:enum']: { knownProp: string };
}
}
}
<fbt:enum knownProp="accepted" unknownProp="rejected" />;

View File

@@ -98,6 +98,17 @@ function f1<T extends (props: {}) => React.ReactElement<any>>(Component: T) {
<Unresolved />;
<Unresolved foo="abc" />;
// regression test for intrinsic containing `:`
declare global {
namespace JSX {
interface IntrinsicElements {
['fbt:enum']: { knownProp: string };
}
}
}
<fbt:enum knownProp="accepted" unknownProp="rejected" />;
//// [jsxElementType.js]
@@ -231,3 +242,4 @@ function f1(Component) {
}
React.createElement(Unresolved, null);
React.createElement(Unresolved, { foo: "abc" });
React.createElement("fbt:enum", { knownProp: "accepted", unknownProp: "rejected" });

View File

@@ -49,17 +49,17 @@ type NewReactJSXElementConstructor<P> =
>P : Symbol(P, Decl(jsxElementType.tsx, 16, 35))
declare global {
>global : Symbol(global, Decl(jsxElementType.tsx, 18, 48))
>global : Symbol(global, Decl(jsxElementType.tsx, 18, 48), Decl(jsxElementType.tsx, 98, 25))
namespace JSX {
>JSX : Symbol(JSX, Decl(react16.d.ts, 2493, 12), Decl(jsxElementType.tsx, 20, 16))
>JSX : Symbol(JSX, Decl(react16.d.ts, 2493, 12), Decl(jsxElementType.tsx, 20, 16), Decl(jsxElementType.tsx, 101, 16))
type ElementType = string | NewReactJSXElementConstructor<any>;
>ElementType : Symbol(ElementType, Decl(jsxElementType.tsx, 21, 17))
>NewReactJSXElementConstructor : Symbol(NewReactJSXElementConstructor, Decl(jsxElementType.tsx, 13, 30))
interface IntrinsicElements {
>IntrinsicElements : Symbol(IntrinsicElements, Decl(react16.d.ts, 2514, 86), Decl(jsxElementType.tsx, 22, 67))
>IntrinsicElements : Symbol(IntrinsicElements, Decl(react16.d.ts, 2514, 86), Decl(jsxElementType.tsx, 22, 67), Decl(jsxElementType.tsx, 102, 17))
['my-custom-element']: React.DOMAttributes<unknown>;
>['my-custom-element'] : Symbol(IntrinsicElements['my-custom-element'], Decl(jsxElementType.tsx, 23, 33))
@@ -272,3 +272,25 @@ function f1<T extends (props: {}) => React.ReactElement<any>>(Component: T) {
<Unresolved foo="abc" />;
>foo : Symbol(foo, Decl(jsxElementType.tsx, 98, 11))
// regression test for intrinsic containing `:`
declare global {
>global : Symbol(global, Decl(jsxElementType.tsx, 18, 48), Decl(jsxElementType.tsx, 98, 25))
namespace JSX {
>JSX : Symbol(JSX, Decl(react16.d.ts, 2493, 12), Decl(jsxElementType.tsx, 20, 16), Decl(jsxElementType.tsx, 101, 16))
interface IntrinsicElements {
>IntrinsicElements : Symbol(IntrinsicElements, Decl(react16.d.ts, 2514, 86), Decl(jsxElementType.tsx, 22, 67), Decl(jsxElementType.tsx, 102, 17))
['fbt:enum']: { knownProp: string };
>['fbt:enum'] : Symbol(IntrinsicElements['fbt:enum'], Decl(jsxElementType.tsx, 103, 33))
>'fbt:enum' : Symbol(IntrinsicElements['fbt:enum'], Decl(jsxElementType.tsx, 103, 33))
>knownProp : Symbol(knownProp, Decl(jsxElementType.tsx, 104, 21))
}
}
}
<fbt:enum knownProp="accepted" unknownProp="rejected" />;
>knownProp : Symbol(knownProp, Decl(jsxElementType.tsx, 109, 9))
>unknownProp : Symbol(unknownProp, Decl(jsxElementType.tsx, 109, 30))

View File

@@ -290,3 +290,24 @@ function f1<T extends (props: {}) => React.ReactElement<any>>(Component: T) {
>Unresolved : any
>foo : string
// regression test for intrinsic containing `:`
declare global {
>global : any
namespace JSX {
interface IntrinsicElements {
['fbt:enum']: { knownProp: string };
>['fbt:enum'] : { knownProp: string; }
>'fbt:enum' : "fbt:enum"
>knownProp : string
}
}
}
<fbt:enum knownProp="accepted" unknownProp="rejected" />;
><fbt:enum knownProp="accepted" unknownProp="rejected" /> : JSX.Element
>fbt : any
>enum : any
>knownProp : string
>unknownProp : string

View File

@@ -99,3 +99,14 @@ function f1<T extends (props: {}) => React.ReactElement<any>>(Component: T) {
<Unresolved />;
<Unresolved foo="abc" />;
// regression test for intrinsic containing `:`
declare global {
namespace JSX {
interface IntrinsicElements {
['fbt:enum']: { knownProp: string };
}
}
}
<fbt:enum knownProp="accepted" unknownProp="rejected" />;