mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-13 02:45:24 -05:00
Co-authored-by: eps1lon <silbermann.sebastian@gmail.com>
This commit is contained in:
@@ -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" />;
|
||||
|
||||
@@ -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" });
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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" />;
|
||||
|
||||
Reference in New Issue
Block a user