diff --git a/tests/baselines/reference/jsxElementType.errors.txt b/tests/baselines/reference/jsxElementType.errors.txt index ddd2efe19cce7..7d18352e01ff5 100644 --- a/tests/baselines/reference/jsxElementType.errors.txt +++ b/tests/baselines/reference/jsxElementType.errors.txt @@ -197,4 +197,15 @@ tests/cases/compiler/jsxElementType.tsx(99,2): error TS2304: Cannot find name 'U ; ~~~~~~~~~~ !!! error TS2304: Cannot find name 'Unresolved'. + + // regression test for intrinsic containing `:` + declare global { + namespace JSX { + interface IntrinsicElements { + ['fbt:enum']: { knownProp: string }; + } + } + } + + ; \ No newline at end of file diff --git a/tests/baselines/reference/jsxElementType.js b/tests/baselines/reference/jsxElementType.js index 13986b0c62e90..2ec2559762e3f 100644 --- a/tests/baselines/reference/jsxElementType.js +++ b/tests/baselines/reference/jsxElementType.js @@ -98,6 +98,17 @@ function f1 React.ReactElement>(Component: T) { ; ; + +// regression test for intrinsic containing `:` +declare global { + namespace JSX { + interface IntrinsicElements { + ['fbt:enum']: { knownProp: string }; + } + } +} + +; //// [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" }); diff --git a/tests/baselines/reference/jsxElementType.symbols b/tests/baselines/reference/jsxElementType.symbols index c932009d84a1f..8aa9e262898ed 100644 --- a/tests/baselines/reference/jsxElementType.symbols +++ b/tests/baselines/reference/jsxElementType.symbols @@ -49,17 +49,17 @@ type NewReactJSXElementConstructor

= >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; >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; >['my-custom-element'] : Symbol(IntrinsicElements['my-custom-element'], Decl(jsxElementType.tsx, 23, 33)) @@ -272,3 +272,25 @@ function f1 React.ReactElement>(Component: T) { ; >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)) + } + } +} + +; +>knownProp : Symbol(knownProp, Decl(jsxElementType.tsx, 109, 9)) +>unknownProp : Symbol(unknownProp, Decl(jsxElementType.tsx, 109, 30)) + diff --git a/tests/baselines/reference/jsxElementType.types b/tests/baselines/reference/jsxElementType.types index 4e9a5a9a8ccb6..e9bf40a419934 100644 --- a/tests/baselines/reference/jsxElementType.types +++ b/tests/baselines/reference/jsxElementType.types @@ -290,3 +290,24 @@ function f1 React.ReactElement>(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 + } + } +} + +; +> : JSX.Element +>fbt : any +>enum : any +>knownProp : string +>unknownProp : string + diff --git a/tests/cases/compiler/jsxElementType.tsx b/tests/cases/compiler/jsxElementType.tsx index 75585a2d99a43..da81a65eb3698 100644 --- a/tests/cases/compiler/jsxElementType.tsx +++ b/tests/cases/compiler/jsxElementType.tsx @@ -99,3 +99,14 @@ function f1 React.ReactElement>(Component: T) { ; ; + +// regression test for intrinsic containing `:` +declare global { + namespace JSX { + interface IntrinsicElements { + ['fbt:enum']: { knownProp: string }; + } + } +} + +;