From 67ea053259838821ce15e06617141f2f4a4f1d53 Mon Sep 17 00:00:00 2001 From: Isabel Duan Date: Wed, 4 Dec 2024 14:45:24 -0800 Subject: [PATCH 1/5] add tests --- ...tFactoryReference(jsx=preserve).errors.txt | 12 ++++++++++ ...xFragmentFactoryReference(jsx=preserve).js | 16 ++++++++++++++ ...mentFactoryReference(jsx=preserve).symbols | 13 +++++++++++ ...agmentFactoryReference(jsx=preserve).types | 22 +++++++++++++++++++ ...mentFactoryReference(jsx=react).errors.txt | 15 +++++++++++++ .../jsxFragmentFactoryReference(jsx=react).js | 16 ++++++++++++++ ...ragmentFactoryReference(jsx=react).symbols | 13 +++++++++++ ...xFragmentFactoryReference(jsx=react).types | 22 +++++++++++++++++++ ...FactoryReference(jsx=react-jsx).errors.txt | 15 +++++++++++++ ...FragmentFactoryReference(jsx=react-jsx).js | 17 ++++++++++++++ ...entFactoryReference(jsx=react-jsx).symbols | 13 +++++++++++ ...gmentFactoryReference(jsx=react-jsx).types | 22 +++++++++++++++++++ .../compiler/jsxFragmentFactoryReference.tsx | 12 ++++++++++ 13 files changed, 208 insertions(+) create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).errors.txt create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).js create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).symbols create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).errors.txt create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).js create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).symbols create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).types create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).errors.txt create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).js create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).symbols create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).types create mode 100644 tests/cases/compiler/jsxFragmentFactoryReference.tsx diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).errors.txt b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).errors.txt new file mode 100644 index 0000000000000..a63e380c1b043 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).errors.txt @@ -0,0 +1,12 @@ +jsxFragmentFactoryReference.tsx(3,9): error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. + + +==== jsxFragmentFactoryReference.tsx (1 errors) ==== + export class LoggedOut { + content = () => ( + <> + ~~ +!!! error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. + ) + } + \ No newline at end of file diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).js b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).js new file mode 100644 index 0000000000000..0b2e9ff67d532 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).js @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// + +//// [jsxFragmentFactoryReference.tsx] +export class LoggedOut { + content = () => ( + <> + ) +} + + +//// [jsxFragmentFactoryReference.jsx] +export class LoggedOut { + constructor() { + this.content = () => (<> ); + } +} diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).symbols b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).symbols new file mode 100644 index 0000000000000..aef2a229b3a97 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// + +=== jsxFragmentFactoryReference.tsx === +export class LoggedOut { +>LoggedOut : Symbol(LoggedOut, Decl(jsxFragmentFactoryReference.tsx, 0, 0)) + + content = () => ( +>content : Symbol(LoggedOut.content, Decl(jsxFragmentFactoryReference.tsx, 0, 24)) + + <> + ) +} + diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types new file mode 100644 index 0000000000000..a1cd45e1bbad1 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// + +=== jsxFragmentFactoryReference.tsx === +export class LoggedOut { +>LoggedOut : LoggedOut +> : ^^^^^^^^^ + + content = () => ( +>content : () => any +> : ^^^^^^^^^ +>() => ( <> ) : () => any +> : ^^^^^^^^^ +>( <> ) : any +> : ^^^ + + <> +><> : any +> : ^^^ + + ) +} + diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).errors.txt b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).errors.txt new file mode 100644 index 0000000000000..485c1c3f4f922 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).errors.txt @@ -0,0 +1,15 @@ +jsxFragmentFactoryReference.tsx(3,9): error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found. +jsxFragmentFactoryReference.tsx(3,9): error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. + + +==== jsxFragmentFactoryReference.tsx (2 errors) ==== + export class LoggedOut { + content = () => ( + <> + ~~ +!!! error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found. + ~~ +!!! error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. + ) + } + \ No newline at end of file diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).js b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).js new file mode 100644 index 0000000000000..11cb1beabbad4 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).js @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// + +//// [jsxFragmentFactoryReference.tsx] +export class LoggedOut { + content = () => ( + <> + ) +} + + +//// [jsxFragmentFactoryReference.js] +export class LoggedOut { + constructor() { + this.content = () => (React.createElement(React.Fragment, null, " ")); + } +} diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).symbols b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).symbols new file mode 100644 index 0000000000000..aef2a229b3a97 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// + +=== jsxFragmentFactoryReference.tsx === +export class LoggedOut { +>LoggedOut : Symbol(LoggedOut, Decl(jsxFragmentFactoryReference.tsx, 0, 0)) + + content = () => ( +>content : Symbol(LoggedOut.content, Decl(jsxFragmentFactoryReference.tsx, 0, 24)) + + <> + ) +} + diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).types b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).types new file mode 100644 index 0000000000000..a1cd45e1bbad1 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).types @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// + +=== jsxFragmentFactoryReference.tsx === +export class LoggedOut { +>LoggedOut : LoggedOut +> : ^^^^^^^^^ + + content = () => ( +>content : () => any +> : ^^^^^^^^^ +>() => ( <> ) : () => any +> : ^^^^^^^^^ +>( <> ) : any +> : ^^^ + + <> +><> : any +> : ^^^ + + ) +} + diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).errors.txt b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).errors.txt new file mode 100644 index 0000000000000..ac4adb20b80bd --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).errors.txt @@ -0,0 +1,15 @@ +jsxFragmentFactoryReference.tsx(3,9): error TS2792: Cannot find module 'react/jsx-runtime'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +jsxFragmentFactoryReference.tsx(3,9): error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. + + +==== jsxFragmentFactoryReference.tsx (2 errors) ==== + export class LoggedOut { + content = () => ( + <> + ~~ +!!! error TS2792: Cannot find module 'react/jsx-runtime'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~ +!!! error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. + ) + } + \ No newline at end of file diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).js b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).js new file mode 100644 index 0000000000000..d03ea8c36ed72 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).js @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// + +//// [jsxFragmentFactoryReference.tsx] +export class LoggedOut { + content = () => ( + <> + ) +} + + +//// [jsxFragmentFactoryReference.js] +import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime"; +export class LoggedOut { + constructor() { + this.content = () => (_jsx(_Fragment, { children: " " })); + } +} diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).symbols b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).symbols new file mode 100644 index 0000000000000..aef2a229b3a97 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// + +=== jsxFragmentFactoryReference.tsx === +export class LoggedOut { +>LoggedOut : Symbol(LoggedOut, Decl(jsxFragmentFactoryReference.tsx, 0, 0)) + + content = () => ( +>content : Symbol(LoggedOut.content, Decl(jsxFragmentFactoryReference.tsx, 0, 24)) + + <> + ) +} + diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).types b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).types new file mode 100644 index 0000000000000..a1cd45e1bbad1 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).types @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// + +=== jsxFragmentFactoryReference.tsx === +export class LoggedOut { +>LoggedOut : LoggedOut +> : ^^^^^^^^^ + + content = () => ( +>content : () => any +> : ^^^^^^^^^ +>() => ( <> ) : () => any +> : ^^^^^^^^^ +>( <> ) : any +> : ^^^ + + <> +><> : any +> : ^^^ + + ) +} + diff --git a/tests/cases/compiler/jsxFragmentFactoryReference.tsx b/tests/cases/compiler/jsxFragmentFactoryReference.tsx new file mode 100644 index 0000000000000..8428e6249e3ad --- /dev/null +++ b/tests/cases/compiler/jsxFragmentFactoryReference.tsx @@ -0,0 +1,12 @@ +// @jsx: preserve, react, react-jsx +// @strict: true +// @skipLibCheck: true +// @target: ES2017 +// @module: ESNext +// @esModuleInterop: true + +export class LoggedOut { + content = () => ( + <> + ) +} From 092e1f4726e6dc545c01b58f984bca16750d6065 Mon Sep 17 00:00:00 2001 From: Isabel Duan Date: Wed, 4 Dec 2024 15:27:44 -0800 Subject: [PATCH 2/5] fix preserve errors --- src/compiler/checker.ts | 10 ++++++---- ...FragmentFactoryReference(jsx=preserve).errors.txt | 12 ------------ .../jsxFragmentFactoryReference(jsx=preserve).types | 2 -- ...seUnaryExpressionNoTypeAssertionInJsx4.errors.txt | 5 +---- 4 files changed, 7 insertions(+), 22 deletions(-) delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 397a424ee7b27..8b2894428528f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -30014,6 +30014,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === JsxEmit.React ? Diagnostics.This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found : undefined; const jsxFactoryNamespace = getJsxNamespace(node); const jsxFactoryLocation = isJsxOpeningLikeElement(node) ? node.tagName : node; + const shouldFactoryRefErr = compilerOptions.jsx !== JsxEmit.Preserve && compilerOptions.jsx !== JsxEmit.ReactNative; // #38720/60122, allow null as jsxFragmentFactory let jsxFactorySym: Symbol | undefined; @@ -30021,7 +30022,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { jsxFactorySym = resolveName( jsxFactoryLocation, jsxFactoryNamespace, - (compilerOptions.jsx === JsxEmit.Preserve || compilerOptions.jsx === JsxEmit.ReactNative) ? SymbolFlags.Value & ~SymbolFlags.Enum : SymbolFlags.Value, + shouldFactoryRefErr ? SymbolFlags.Value : SymbolFlags.Value & ~SymbolFlags.Enum, jsxFactoryRefErr, /*isUse*/ true, ); @@ -30046,7 +30047,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { resolveName( jsxFactoryLocation, localJsxNamespace, - (compilerOptions.jsx === JsxEmit.Preserve || compilerOptions.jsx === JsxEmit.ReactNative) ? SymbolFlags.Value & ~SymbolFlags.Enum : SymbolFlags.Value, + shouldFactoryRefErr ? SymbolFlags.Value : SymbolFlags.Value & ~SymbolFlags.Enum, jsxFactoryRefErr, /*isUse*/ true, ); @@ -36835,12 +36836,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // #38720/60122, allow null as jsxFragmentFactory if (jsxFragmentFactoryName === "null") return sourceFileLinks.jsxFragmentType = anyType; - const jsxFactoryRefErr = diagnostics ? Diagnostics.Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found : undefined; + const shouldFactoryRefErr = compilerOptions.jsx !== JsxEmit.Preserve && compilerOptions.jsx !== JsxEmit.ReactNative; + const jsxFactoryRefErr = diagnostics && shouldFactoryRefErr ? Diagnostics.Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found : undefined; const jsxFactorySymbol = getJsxNamespaceContainerForImplicitImport(node) ?? resolveName( node, jsxFragmentFactoryName, - (compilerOptions.jsx === JsxEmit.Preserve || compilerOptions.jsx === JsxEmit.ReactNative) ? SymbolFlags.Value & ~SymbolFlags.Enum : SymbolFlags.Value, + shouldFactoryRefErr ? SymbolFlags.Value : SymbolFlags.Value & ~SymbolFlags.Enum, /*nameNotFoundMessage*/ jsxFactoryRefErr, /*isUse*/ true, ); diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).errors.txt b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).errors.txt deleted file mode 100644 index a63e380c1b043..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -jsxFragmentFactoryReference.tsx(3,9): error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. - - -==== jsxFragmentFactoryReference.tsx (1 errors) ==== - export class LoggedOut { - content = () => ( - <> - ~~ -!!! error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. - ) - } - \ No newline at end of file diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types index a1cd45e1bbad1..398b0e0f779e9 100644 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types @@ -11,11 +11,9 @@ export class LoggedOut { >() => ( <> ) : () => any > : ^^^^^^^^^ >( <> ) : any -> : ^^^ <> ><> : any -> : ^^^ ) } diff --git a/tests/baselines/reference/parseUnaryExpressionNoTypeAssertionInJsx4.errors.txt b/tests/baselines/reference/parseUnaryExpressionNoTypeAssertionInJsx4.errors.txt index 403885082355f..2c200912716c1 100644 --- a/tests/baselines/reference/parseUnaryExpressionNoTypeAssertionInJsx4.errors.txt +++ b/tests/baselines/reference/parseUnaryExpressionNoTypeAssertionInJsx4.errors.txt @@ -1,12 +1,11 @@ index.tsx(3,14): error TS17008: JSX element 'number' has no corresponding closing tag. -index.tsx(4,13): error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. index.tsx(4,13): error TS17014: JSX fragment has no corresponding closing tag. index.tsx(5,14): error TS1003: Identifier expected. index.tsx(5,18): error TS1382: Unexpected token. Did you mean `{'>'}` or `>`? index.tsx(6,1): error TS1005: ' x; @@ -14,8 +13,6 @@ index.tsx(6,1): error TS1005: ' x; ~~ -!!! error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. - ~~ !!! error TS17014: JSX fragment has no corresponding closing tag. const c = + <1234> x; ~~~~ From 5b2f6358ecf1fb3a02dc99e65a21b38835bb7254 Mon Sep 17 00:00:00 2001 From: Isabel Duan Date: Wed, 4 Dec 2024 15:36:11 -0800 Subject: [PATCH 3/5] add tests for if pragma specified with preserve --- .../jsxRuntimePragma(jsx=preserve).js | 88 +++++++++ .../jsxRuntimePragma(jsx=preserve).symbols | 95 +++++++++ .../jsxRuntimePragma(jsx=preserve).types | 183 ++++++++++++++++++ tests/cases/compiler/jsxRuntimePragma.ts | 2 +- 4 files changed, 367 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/jsxRuntimePragma(jsx=preserve).js create mode 100644 tests/baselines/reference/jsxRuntimePragma(jsx=preserve).symbols create mode 100644 tests/baselines/reference/jsxRuntimePragma(jsx=preserve).types diff --git a/tests/baselines/reference/jsxRuntimePragma(jsx=preserve).js b/tests/baselines/reference/jsxRuntimePragma(jsx=preserve).js new file mode 100644 index 0000000000000..6310cf21524b4 --- /dev/null +++ b/tests/baselines/reference/jsxRuntimePragma(jsx=preserve).js @@ -0,0 +1,88 @@ +//// [tests/cases/compiler/jsxRuntimePragma.ts] //// + +//// [one.tsx] +/// +/* @jsxRuntime classic */ +import * as React from "react"; +export const HelloWorld = () =>

Hello world

; +export const frag = <>
; +export const selfClosing = ; +//// [two.tsx] +/// +/* @jsxRuntime automatic */ +export const HelloWorld = () =>

Hello world

; +export const frag = <>
; +export const selfClosing = ; +//// [three.tsx] +/// +/* @jsxRuntime classic */ +/* @jsxRuntime automatic */ +export const HelloWorld = () =>

Hello world

; +export const frag = <>
; +export const selfClosing = ; +//// [four.tsx] +/// +/* @jsxRuntime automatic */ +/* @jsxRuntime classic */ +import * as React from "react"; +export const HelloWorld = () =>

Hello world

; +export const frag = <>
; +export const selfClosing = ; +//// [index.ts] +export * as one from "./one.js"; +export * as two from "./two.js"; +export * as three from "./three.js"; +export * as four from "./four.js"; + +//// [one.jsx] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.selfClosing = exports.frag = exports.HelloWorld = void 0; +/// +/* @jsxRuntime classic */ +var React = require("react"); +var HelloWorld = function () { return

Hello world

; }; +exports.HelloWorld = HelloWorld; +exports.frag = <>
; +exports.selfClosing = ; +//// [two.jsx] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.selfClosing = exports.frag = exports.HelloWorld = void 0; +/// +/* @jsxRuntime automatic */ +var HelloWorld = function () { return

Hello world

; }; +exports.HelloWorld = HelloWorld; +exports.frag = <>
; +exports.selfClosing = ; +//// [three.jsx] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.selfClosing = exports.frag = exports.HelloWorld = void 0; +/// +/* @jsxRuntime classic */ +/* @jsxRuntime automatic */ +var HelloWorld = function () { return

Hello world

; }; +exports.HelloWorld = HelloWorld; +exports.frag = <>
; +exports.selfClosing = ; +//// [four.jsx] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.selfClosing = exports.frag = exports.HelloWorld = void 0; +/// +/* @jsxRuntime automatic */ +/* @jsxRuntime classic */ +var React = require("react"); +var HelloWorld = function () { return

Hello world

; }; +exports.HelloWorld = HelloWorld; +exports.frag = <>
; +exports.selfClosing = ; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.four = exports.three = exports.two = exports.one = void 0; +exports.one = require("./one.js"); +exports.two = require("./two.js"); +exports.three = require("./three.js"); +exports.four = require("./four.js"); diff --git a/tests/baselines/reference/jsxRuntimePragma(jsx=preserve).symbols b/tests/baselines/reference/jsxRuntimePragma(jsx=preserve).symbols new file mode 100644 index 0000000000000..0060411a1a943 --- /dev/null +++ b/tests/baselines/reference/jsxRuntimePragma(jsx=preserve).symbols @@ -0,0 +1,95 @@ +//// [tests/cases/compiler/jsxRuntimePragma.ts] //// + +=== one.tsx === +/// +/* @jsxRuntime classic */ +import * as React from "react"; +>React : Symbol(React, Decl(one.tsx, 2, 6)) + +export const HelloWorld = () =>

Hello world

; +>HelloWorld : Symbol(HelloWorld, Decl(one.tsx, 3, 12)) +>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react16.d.ts, 2556, 106)) +>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react16.d.ts, 2556, 106)) + +export const frag = <>
; +>frag : Symbol(frag, Decl(one.tsx, 4, 12)) +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2546, 114)) +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2546, 114)) + +export const selfClosing = ; +>selfClosing : Symbol(selfClosing, Decl(one.tsx, 5, 12)) +>img : Symbol(JSX.IntrinsicElements.img, Decl(react16.d.ts, 2569, 114)) +>src : Symbol(src, Decl(one.tsx, 5, 31)) + +=== two.tsx === +/// +/* @jsxRuntime automatic */ +export const HelloWorld = () =>

Hello world

; +>HelloWorld : Symbol(HelloWorld, Decl(two.tsx, 2, 12)) +>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react16.d.ts, 2556, 106)) +>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react16.d.ts, 2556, 106)) + +export const frag = <>
; +>frag : Symbol(frag, Decl(two.tsx, 3, 12)) +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2546, 114)) +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2546, 114)) + +export const selfClosing = ; +>selfClosing : Symbol(selfClosing, Decl(two.tsx, 4, 12)) +>img : Symbol(JSX.IntrinsicElements.img, Decl(react16.d.ts, 2569, 114)) +>src : Symbol(src, Decl(two.tsx, 4, 31)) + +=== three.tsx === +/// +/* @jsxRuntime classic */ +/* @jsxRuntime automatic */ +export const HelloWorld = () =>

Hello world

; +>HelloWorld : Symbol(HelloWorld, Decl(three.tsx, 3, 12)) +>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react16.d.ts, 2556, 106)) +>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react16.d.ts, 2556, 106)) + +export const frag = <>
; +>frag : Symbol(frag, Decl(three.tsx, 4, 12)) +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2546, 114)) +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2546, 114)) + +export const selfClosing = ; +>selfClosing : Symbol(selfClosing, Decl(three.tsx, 5, 12)) +>img : Symbol(JSX.IntrinsicElements.img, Decl(react16.d.ts, 2569, 114)) +>src : Symbol(src, Decl(three.tsx, 5, 31)) + +=== four.tsx === +/// +/* @jsxRuntime automatic */ +/* @jsxRuntime classic */ +import * as React from "react"; +>React : Symbol(React, Decl(four.tsx, 3, 6)) + +export const HelloWorld = () =>

Hello world

; +>HelloWorld : Symbol(HelloWorld, Decl(four.tsx, 4, 12)) +>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react16.d.ts, 2556, 106)) +>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react16.d.ts, 2556, 106)) + +export const frag = <>
; +>frag : Symbol(frag, Decl(four.tsx, 5, 12)) +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2546, 114)) +>div : Symbol(JSX.IntrinsicElements.div, Decl(react16.d.ts, 2546, 114)) + +export const selfClosing = ; +>selfClosing : Symbol(selfClosing, Decl(four.tsx, 6, 12)) +>img : Symbol(JSX.IntrinsicElements.img, Decl(react16.d.ts, 2569, 114)) +>src : Symbol(src, Decl(four.tsx, 6, 31)) + +=== index.ts === +export * as one from "./one.js"; +>one : Symbol(one, Decl(index.ts, 0, 6)) + +export * as two from "./two.js"; +>two : Symbol(two, Decl(index.ts, 1, 6)) + +export * as three from "./three.js"; +>three : Symbol(three, Decl(index.ts, 2, 6)) + +export * as four from "./four.js"; +>four : Symbol(four, Decl(index.ts, 3, 6)) + diff --git a/tests/baselines/reference/jsxRuntimePragma(jsx=preserve).types b/tests/baselines/reference/jsxRuntimePragma(jsx=preserve).types new file mode 100644 index 0000000000000..87eb419fb5327 --- /dev/null +++ b/tests/baselines/reference/jsxRuntimePragma(jsx=preserve).types @@ -0,0 +1,183 @@ +//// [tests/cases/compiler/jsxRuntimePragma.ts] //// + +=== Performance Stats === +Assignability cache: 2,500 +Type Count: 5,000 +Instantiation count: 50,000 +Symbol count: 50,000 + +=== one.tsx === +/// +/* @jsxRuntime classic */ +import * as React from "react"; +>React : typeof React +> : ^^^^^^^^^^^^ + +export const HelloWorld = () =>

Hello world

; +>HelloWorld : () => JSX.Element +> : ^^^^^^^^^^^^^^^^^ +>() =>

Hello world

: () => JSX.Element +> : ^^^^^^^^^^^^^^^^^ +>

Hello world

: JSX.Element +> : ^^^^^^^^^^^ +>h1 : any +> : ^^^ +>h1 : any +> : ^^^ + +export const frag = <>
; +>frag : JSX.Element +> : ^^^^^^^^^^^ +><>
: JSX.Element +> : ^^^^^^^^^^^ +>
: JSX.Element +> : ^^^^^^^^^^^ +>div : any +> : ^^^ +>div : any +> : ^^^ + +export const selfClosing = ; +>selfClosing : JSX.Element +> : ^^^^^^^^^^^ +> : JSX.Element +> : ^^^^^^^^^^^ +>img : any +> : ^^^ +>src : string +> : ^^^^^^ + +=== two.tsx === +/// +/* @jsxRuntime automatic */ +export const HelloWorld = () =>

Hello world

; +>HelloWorld : () => JSX.Element +> : ^^^^^^^^^^^^^^^^^ +>() =>

Hello world

: () => JSX.Element +> : ^^^^^^^^^^^^^^^^^ +>

Hello world

: JSX.Element +> : ^^^^^^^^^^^ +>h1 : any +> : ^^^ +>h1 : any +> : ^^^ + +export const frag = <>
; +>frag : JSX.Element +> : ^^^^^^^^^^^ +><>
: JSX.Element +> : ^^^^^^^^^^^ +>
: JSX.Element +> : ^^^^^^^^^^^ +>div : any +> : ^^^ +>div : any +> : ^^^ + +export const selfClosing = ; +>selfClosing : JSX.Element +> : ^^^^^^^^^^^ +> : JSX.Element +> : ^^^^^^^^^^^ +>img : any +> : ^^^ +>src : string +> : ^^^^^^ + +=== three.tsx === +/// +/* @jsxRuntime classic */ +/* @jsxRuntime automatic */ +export const HelloWorld = () =>

Hello world

; +>HelloWorld : () => JSX.Element +> : ^^^^^^^^^^^^^^^^^ +>() =>

Hello world

: () => JSX.Element +> : ^^^^^^^^^^^^^^^^^ +>

Hello world

: JSX.Element +> : ^^^^^^^^^^^ +>h1 : any +> : ^^^ +>h1 : any +> : ^^^ + +export const frag = <>
; +>frag : JSX.Element +> : ^^^^^^^^^^^ +><>
: JSX.Element +> : ^^^^^^^^^^^ +>
: JSX.Element +> : ^^^^^^^^^^^ +>div : any +> : ^^^ +>div : any +> : ^^^ + +export const selfClosing = ; +>selfClosing : JSX.Element +> : ^^^^^^^^^^^ +> : JSX.Element +> : ^^^^^^^^^^^ +>img : any +> : ^^^ +>src : string +> : ^^^^^^ + +=== four.tsx === +/// +/* @jsxRuntime automatic */ +/* @jsxRuntime classic */ +import * as React from "react"; +>React : typeof React +> : ^^^^^^^^^^^^ + +export const HelloWorld = () =>

Hello world

; +>HelloWorld : () => JSX.Element +> : ^^^^^^^^^^^^^^^^^ +>() =>

Hello world

: () => JSX.Element +> : ^^^^^^^^^^^^^^^^^ +>

Hello world

: JSX.Element +> : ^^^^^^^^^^^ +>h1 : any +> : ^^^ +>h1 : any +> : ^^^ + +export const frag = <>
; +>frag : JSX.Element +> : ^^^^^^^^^^^ +><>
: JSX.Element +> : ^^^^^^^^^^^ +>
: JSX.Element +> : ^^^^^^^^^^^ +>div : any +> : ^^^ +>div : any +> : ^^^ + +export const selfClosing = ; +>selfClosing : JSX.Element +> : ^^^^^^^^^^^ +> : JSX.Element +> : ^^^^^^^^^^^ +>img : any +> : ^^^ +>src : string +> : ^^^^^^ + +=== index.ts === +export * as one from "./one.js"; +>one : typeof import("one") +> : ^^^^^^^^^^^^^^^^^^^^ + +export * as two from "./two.js"; +>two : typeof import("two") +> : ^^^^^^^^^^^^^^^^^^^^ + +export * as three from "./three.js"; +>three : typeof import("three") +> : ^^^^^^^^^^^^^^^^^^^^^^ + +export * as four from "./four.js"; +>four : typeof import("four") +> : ^^^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/cases/compiler/jsxRuntimePragma.ts b/tests/cases/compiler/jsxRuntimePragma.ts index c3d1829b3861d..0a14e9503e79d 100644 --- a/tests/cases/compiler/jsxRuntimePragma.ts +++ b/tests/cases/compiler/jsxRuntimePragma.ts @@ -1,4 +1,4 @@ -// @jsx: react,react-jsx,react-jsxdev +// @jsx: react,react-jsx,react-jsxdev,preserve // @filename: one.tsx /// /* @jsxRuntime classic */ From 55e3b0af93a628495c5a63a092005255a9a89c4e Mon Sep 17 00:00:00 2001 From: Isabel Duan Date: Thu, 5 Dec 2024 16:19:35 -0800 Subject: [PATCH 4/5] remove extra errors --- src/compiler/checker.ts | 10 +++++---- ...xFragmentFactoryReference(jsx=preserve).js | 4 ++-- ...mentFactoryReference(jsx=preserve).symbols | 2 +- ...agmentFactoryReference(jsx=preserve).types | 10 ++++----- ...mentFactoryReference(jsx=react).errors.txt | 2 +- .../jsxFragmentFactoryReference(jsx=react).js | 4 ++-- ...ragmentFactoryReference(jsx=react).symbols | 2 +- ...xFragmentFactoryReference(jsx=react).types | 14 ++++++------ ...FactoryReference(jsx=react-jsx).errors.txt | 7 ++---- ...FragmentFactoryReference(jsx=react-jsx).js | 4 ++-- ...entFactoryReference(jsx=react-jsx).symbols | 2 +- ...gmentFactoryReference(jsx=react-jsx).types | 14 ++++++------ ...toryReference(jsx=react-jsxdev).errors.txt | 12 ++++++++++ ...gmentFactoryReference(jsx=react-jsxdev).js | 18 +++++++++++++++ ...FactoryReference(jsx=react-jsxdev).symbols | 13 +++++++++++ ...ntFactoryReference(jsx=react-jsxdev).types | 22 +++++++++++++++++++ ...gmentFactoryReference(jsx=react-native).js | 16 ++++++++++++++ ...FactoryReference(jsx=react-native).symbols | 13 +++++++++++ ...ntFactoryReference(jsx=react-native).types | 20 +++++++++++++++++ ...formCustomImport(jsx=react-jsx).errors.txt | 5 +---- ...mCustomImport(jsx=react-jsxdev).errors.txt | 5 +---- ...stomImportPragma(jsx=react-jsx).errors.txt | 5 +---- ...mImportPragma(jsx=react-jsxdev).errors.txt | 5 +---- ...ExpressionNoTypeAssertionInJsx2.errors.txt | 5 +---- .../compiler/jsxFragmentFactoryReference.tsx | 4 ++-- 25 files changed, 158 insertions(+), 60 deletions(-) create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).errors.txt create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).js create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).symbols create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).types create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).js create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).symbols create mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).types diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8b2894428528f..4f2c0392e069a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -36833,16 +36833,18 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (sourceFileLinks.jsxFragmentType !== undefined) return sourceFileLinks.jsxFragmentType; const jsxFragmentFactoryName = getJsxNamespace(node); + // #38720/60122, allow null as jsxFragmentFactory - if (jsxFragmentFactoryName === "null") return sourceFileLinks.jsxFragmentType = anyType; + const shouldResolveFactoryReference = (compilerOptions.jsx === JsxEmit.React || compilerOptions.jsxFragmentFactory !== undefined) && jsxFragmentFactoryName !== "null"; + if (!shouldResolveFactoryReference) return sourceFileLinks.jsxFragmentType = anyType; - const shouldFactoryRefErr = compilerOptions.jsx !== JsxEmit.Preserve && compilerOptions.jsx !== JsxEmit.ReactNative; - const jsxFactoryRefErr = diagnostics && shouldFactoryRefErr ? Diagnostics.Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found : undefined; + const shouldModuleRefErr = compilerOptions.jsx !== JsxEmit.Preserve && compilerOptions.jsx !== JsxEmit.ReactNative; + const jsxFactoryRefErr = diagnostics ? Diagnostics.Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found : undefined; const jsxFactorySymbol = getJsxNamespaceContainerForImplicitImport(node) ?? resolveName( node, jsxFragmentFactoryName, - shouldFactoryRefErr ? SymbolFlags.Value : SymbolFlags.Value & ~SymbolFlags.Enum, + shouldModuleRefErr ? SymbolFlags.Value : SymbolFlags.Value & ~SymbolFlags.Enum, /*nameNotFoundMessage*/ jsxFactoryRefErr, /*isUse*/ true, ); diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).js b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).js index 0b2e9ff67d532..dc0e55b29d7b7 100644 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).js +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).js @@ -3,7 +3,7 @@ //// [jsxFragmentFactoryReference.tsx] export class LoggedOut { content = () => ( - <> + <> ) } @@ -11,6 +11,6 @@ export class LoggedOut { //// [jsxFragmentFactoryReference.jsx] export class LoggedOut { constructor() { - this.content = () => (<> ); + this.content = () => (<>); } } diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).symbols b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).symbols index aef2a229b3a97..aa071a7722864 100644 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).symbols +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).symbols @@ -7,7 +7,7 @@ export class LoggedOut { content = () => ( >content : Symbol(LoggedOut.content, Decl(jsxFragmentFactoryReference.tsx, 0, 24)) - <> + <> ) } diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types index 398b0e0f779e9..e4560acb8822c 100644 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types @@ -8,12 +8,12 @@ export class LoggedOut { content = () => ( >content : () => any > : ^^^^^^^^^ ->() => ( <> ) : () => any -> : ^^^^^^^^^ ->( <> ) : any +>() => ( <> ) : () => any +> : ^^^^^^^^^ +>( <> ) : any - <> -><> : any + <> +><> : any ) } diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).errors.txt b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).errors.txt index 485c1c3f4f922..a32738b88ce84 100644 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).errors.txt +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).errors.txt @@ -5,7 +5,7 @@ jsxFragmentFactoryReference.tsx(3,9): error TS2879: Using JSX fragments requires ==== jsxFragmentFactoryReference.tsx (2 errors) ==== export class LoggedOut { content = () => ( - <> + <> ~~ !!! error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found. ~~ diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).js b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).js index 11cb1beabbad4..9df51169ea47a 100644 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).js +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).js @@ -3,7 +3,7 @@ //// [jsxFragmentFactoryReference.tsx] export class LoggedOut { content = () => ( - <> + <> ) } @@ -11,6 +11,6 @@ export class LoggedOut { //// [jsxFragmentFactoryReference.js] export class LoggedOut { constructor() { - this.content = () => (React.createElement(React.Fragment, null, " ")); + this.content = () => (React.createElement(React.Fragment, null)); } } diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).symbols b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).symbols index aef2a229b3a97..aa071a7722864 100644 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).symbols +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).symbols @@ -7,7 +7,7 @@ export class LoggedOut { content = () => ( >content : Symbol(LoggedOut.content, Decl(jsxFragmentFactoryReference.tsx, 0, 24)) - <> + <> ) } diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).types b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).types index a1cd45e1bbad1..f8d977761f572 100644 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).types +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).types @@ -8,14 +8,14 @@ export class LoggedOut { content = () => ( >content : () => any > : ^^^^^^^^^ ->() => ( <> ) : () => any -> : ^^^^^^^^^ ->( <> ) : any -> : ^^^ +>() => ( <> ) : () => any +> : ^^^^^^^^^ +>( <> ) : any +> : ^^^ - <> -><> : any -> : ^^^ + <> +><> : any +> : ^^^ ) } diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).errors.txt b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).errors.txt index ac4adb20b80bd..11dd272e65c7f 100644 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).errors.txt +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).errors.txt @@ -1,15 +1,12 @@ jsxFragmentFactoryReference.tsx(3,9): error TS2792: Cannot find module 'react/jsx-runtime'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -jsxFragmentFactoryReference.tsx(3,9): error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. -==== jsxFragmentFactoryReference.tsx (2 errors) ==== +==== jsxFragmentFactoryReference.tsx (1 errors) ==== export class LoggedOut { content = () => ( - <> + <> ~~ !!! error TS2792: Cannot find module 'react/jsx-runtime'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - ~~ -!!! error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. ) } \ No newline at end of file diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).js b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).js index d03ea8c36ed72..4f12b96321745 100644 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).js +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).js @@ -3,7 +3,7 @@ //// [jsxFragmentFactoryReference.tsx] export class LoggedOut { content = () => ( - <> + <> ) } @@ -12,6 +12,6 @@ export class LoggedOut { import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime"; export class LoggedOut { constructor() { - this.content = () => (_jsx(_Fragment, { children: " " })); + this.content = () => (_jsx(_Fragment, {})); } } diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).symbols b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).symbols index aef2a229b3a97..aa071a7722864 100644 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).symbols +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).symbols @@ -7,7 +7,7 @@ export class LoggedOut { content = () => ( >content : Symbol(LoggedOut.content, Decl(jsxFragmentFactoryReference.tsx, 0, 24)) - <> + <> ) } diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).types b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).types index a1cd45e1bbad1..f8d977761f572 100644 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).types +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).types @@ -8,14 +8,14 @@ export class LoggedOut { content = () => ( >content : () => any > : ^^^^^^^^^ ->() => ( <> ) : () => any -> : ^^^^^^^^^ ->( <> ) : any -> : ^^^ +>() => ( <> ) : () => any +> : ^^^^^^^^^ +>( <> ) : any +> : ^^^ - <> -><> : any -> : ^^^ + <> +><> : any +> : ^^^ ) } diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).errors.txt b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).errors.txt new file mode 100644 index 0000000000000..b9185baa77ec7 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).errors.txt @@ -0,0 +1,12 @@ +jsxFragmentFactoryReference.tsx(3,9): error TS2792: Cannot find module 'react/jsx-dev-runtime'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +==== jsxFragmentFactoryReference.tsx (1 errors) ==== + export class LoggedOut { + content = () => ( + <> + ~~ +!!! error TS2792: Cannot find module 'react/jsx-dev-runtime'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ) + } + \ No newline at end of file diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).js b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).js new file mode 100644 index 0000000000000..e2fc59e87282c --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).js @@ -0,0 +1,18 @@ +//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// + +//// [jsxFragmentFactoryReference.tsx] +export class LoggedOut { + content = () => ( + <> + ) +} + + +//// [jsxFragmentFactoryReference.js] +import { Fragment as _Fragment, jsxDEV as _jsxDEV } from "react/jsx-dev-runtime"; +const _jsxFileName = "jsxFragmentFactoryReference.tsx"; +export class LoggedOut { + constructor() { + this.content = () => (_jsxDEV(_Fragment, {}, void 0, false, { fileName: _jsxFileName, lineNumber: 2, columnNumber: 22 }, this)); + } +} diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).symbols b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).symbols new file mode 100644 index 0000000000000..aa071a7722864 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// + +=== jsxFragmentFactoryReference.tsx === +export class LoggedOut { +>LoggedOut : Symbol(LoggedOut, Decl(jsxFragmentFactoryReference.tsx, 0, 0)) + + content = () => ( +>content : Symbol(LoggedOut.content, Decl(jsxFragmentFactoryReference.tsx, 0, 24)) + + <> + ) +} + diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).types b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).types new file mode 100644 index 0000000000000..f8d977761f572 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).types @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// + +=== jsxFragmentFactoryReference.tsx === +export class LoggedOut { +>LoggedOut : LoggedOut +> : ^^^^^^^^^ + + content = () => ( +>content : () => any +> : ^^^^^^^^^ +>() => ( <> ) : () => any +> : ^^^^^^^^^ +>( <> ) : any +> : ^^^ + + <> +><> : any +> : ^^^ + + ) +} + diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).js b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).js new file mode 100644 index 0000000000000..56011d7ec1fb6 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).js @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// + +//// [jsxFragmentFactoryReference.tsx] +export class LoggedOut { + content = () => ( + <> + ) +} + + +//// [jsxFragmentFactoryReference.js] +export class LoggedOut { + constructor() { + this.content = () => (<>); + } +} diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).symbols b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).symbols new file mode 100644 index 0000000000000..aa071a7722864 --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// + +=== jsxFragmentFactoryReference.tsx === +export class LoggedOut { +>LoggedOut : Symbol(LoggedOut, Decl(jsxFragmentFactoryReference.tsx, 0, 0)) + + content = () => ( +>content : Symbol(LoggedOut.content, Decl(jsxFragmentFactoryReference.tsx, 0, 24)) + + <> + ) +} + diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).types b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).types new file mode 100644 index 0000000000000..e4560acb8822c --- /dev/null +++ b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).types @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// + +=== jsxFragmentFactoryReference.tsx === +export class LoggedOut { +>LoggedOut : LoggedOut +> : ^^^^^^^^^ + + content = () => ( +>content : () => any +> : ^^^^^^^^^ +>() => ( <> ) : () => any +> : ^^^^^^^^^ +>( <> ) : any + + <> +><> : any + + ) +} + diff --git a/tests/baselines/reference/jsxJsxsCjsTransformCustomImport(jsx=react-jsx).errors.txt b/tests/baselines/reference/jsxJsxsCjsTransformCustomImport(jsx=react-jsx).errors.txt index 2b8fbaf4e46f0..248540ed384da 100644 --- a/tests/baselines/reference/jsxJsxsCjsTransformCustomImport(jsx=react-jsx).errors.txt +++ b/tests/baselines/reference/jsxJsxsCjsTransformCustomImport(jsx=react-jsx).errors.txt @@ -1,14 +1,11 @@ jsxJsxsCjsTransformCustomImport.tsx(2,11): error TS2875: This JSX tag requires the module path 'preact/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. -jsxJsxsCjsTransformCustomImport.tsx(2,11): error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. -==== jsxJsxsCjsTransformCustomImport.tsx (2 errors) ==== +==== jsxJsxsCjsTransformCustomImport.tsx (1 errors) ==== /// const a = <> ~~ !!! error TS2875: This JSX tag requires the module path 'preact/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - ~~ -!!! error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found.

text
diff --git a/tests/baselines/reference/jsxJsxsCjsTransformCustomImport(jsx=react-jsxdev).errors.txt b/tests/baselines/reference/jsxJsxsCjsTransformCustomImport(jsx=react-jsxdev).errors.txt index 31af5093deb3a..e66480f8dce2f 100644 --- a/tests/baselines/reference/jsxJsxsCjsTransformCustomImport(jsx=react-jsxdev).errors.txt +++ b/tests/baselines/reference/jsxJsxsCjsTransformCustomImport(jsx=react-jsxdev).errors.txt @@ -1,14 +1,11 @@ jsxJsxsCjsTransformCustomImport.tsx(2,11): error TS2875: This JSX tag requires the module path 'preact/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. -jsxJsxsCjsTransformCustomImport.tsx(2,11): error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. -==== jsxJsxsCjsTransformCustomImport.tsx (2 errors) ==== +==== jsxJsxsCjsTransformCustomImport.tsx (1 errors) ==== /// const a = <> ~~ !!! error TS2875: This JSX tag requires the module path 'preact/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - ~~ -!!! error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found.

text
diff --git a/tests/baselines/reference/jsxJsxsCjsTransformCustomImportPragma(jsx=react-jsx).errors.txt b/tests/baselines/reference/jsxJsxsCjsTransformCustomImportPragma(jsx=react-jsx).errors.txt index 7155c43a5dad4..c37e010cab834 100644 --- a/tests/baselines/reference/jsxJsxsCjsTransformCustomImportPragma(jsx=react-jsx).errors.txt +++ b/tests/baselines/reference/jsxJsxsCjsTransformCustomImportPragma(jsx=react-jsx).errors.txt @@ -1,5 +1,4 @@ preact.tsx(3,11): error TS2875: This JSX tag requires the module path 'preact/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. -preact.tsx(3,11): error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. ==== react.tsx (0 errors) ==== @@ -13,14 +12,12 @@ preact.tsx(3,11): error TS2879: Using JSX fragments requires fragment factory 'R export {}; -==== preact.tsx (2 errors) ==== +==== preact.tsx (1 errors) ==== /// /* @jsxImportSource preact */ const a = <> ~~ !!! error TS2875: This JSX tag requires the module path 'preact/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - ~~ -!!! error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found.

text
diff --git a/tests/baselines/reference/jsxJsxsCjsTransformCustomImportPragma(jsx=react-jsxdev).errors.txt b/tests/baselines/reference/jsxJsxsCjsTransformCustomImportPragma(jsx=react-jsxdev).errors.txt index ad4bb3c20b12a..79e8e02a87b2f 100644 --- a/tests/baselines/reference/jsxJsxsCjsTransformCustomImportPragma(jsx=react-jsxdev).errors.txt +++ b/tests/baselines/reference/jsxJsxsCjsTransformCustomImportPragma(jsx=react-jsxdev).errors.txt @@ -1,5 +1,4 @@ preact.tsx(3,11): error TS2875: This JSX tag requires the module path 'preact/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. -preact.tsx(3,11): error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. ==== react.tsx (0 errors) ==== @@ -13,14 +12,12 @@ preact.tsx(3,11): error TS2879: Using JSX fragments requires fragment factory 'R export {}; -==== preact.tsx (2 errors) ==== +==== preact.tsx (1 errors) ==== /// /* @jsxImportSource preact */ const a = <> ~~ !!! error TS2875: This JSX tag requires the module path 'preact/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. - ~~ -!!! error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found.

text
diff --git a/tests/baselines/reference/parseUnaryExpressionNoTypeAssertionInJsx2.errors.txt b/tests/baselines/reference/parseUnaryExpressionNoTypeAssertionInJsx2.errors.txt index b4fb215aaed6f..69e07e52360a5 100644 --- a/tests/baselines/reference/parseUnaryExpressionNoTypeAssertionInJsx2.errors.txt +++ b/tests/baselines/reference/parseUnaryExpressionNoTypeAssertionInJsx2.errors.txt @@ -1,17 +1,14 @@ index.js(2,12): error TS17014: JSX fragment has no corresponding closing tag. -index.js(2,13): error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. index.js(2,13): error TS17004: Cannot use JSX unless the '--jsx' flag is provided. index.js(3,1): error TS1005: ' x; ~~~ !!! error TS17014: JSX fragment has no corresponding closing tag. ~~ -!!! error TS2879: Using JSX fragments requires fragment factory 'React' to be in scope, but it could not be found. - ~~ !!! error TS17004: Cannot use JSX unless the '--jsx' flag is provided. diff --git a/tests/cases/compiler/jsxFragmentFactoryReference.tsx b/tests/cases/compiler/jsxFragmentFactoryReference.tsx index 8428e6249e3ad..de3431b1f7823 100644 --- a/tests/cases/compiler/jsxFragmentFactoryReference.tsx +++ b/tests/cases/compiler/jsxFragmentFactoryReference.tsx @@ -1,4 +1,4 @@ -// @jsx: preserve, react, react-jsx +// @jsx: preserve, react, react-jsx, react-jsxdev, react-native // @strict: true // @skipLibCheck: true // @target: ES2017 @@ -7,6 +7,6 @@ export class LoggedOut { content = () => ( - <> + <> ) } From 8ebd32240b1a69aff9b393600eaeb1ffcb26a792 Mon Sep 17 00:00:00 2001 From: Isabel Duan Date: Mon, 9 Dec 2024 10:36:57 -0800 Subject: [PATCH 5/5] remove extra tests --- ...xFragmentFactoryReference(jsx=preserve).js | 16 -------------- ...mentFactoryReference(jsx=preserve).symbols | 13 ----------- ...agmentFactoryReference(jsx=preserve).types | 20 ----------------- .../jsxFragmentFactoryReference(jsx=react).js | 16 -------------- ...ragmentFactoryReference(jsx=react).symbols | 13 ----------- ...xFragmentFactoryReference(jsx=react).types | 22 ------------------- ...FragmentFactoryReference(jsx=react-jsx).js | 17 -------------- ...entFactoryReference(jsx=react-jsx).symbols | 13 ----------- ...gmentFactoryReference(jsx=react-jsx).types | 22 ------------------- ...gmentFactoryReference(jsx=react-jsxdev).js | 18 --------------- ...FactoryReference(jsx=react-jsxdev).symbols | 13 ----------- ...ntFactoryReference(jsx=react-jsxdev).types | 22 ------------------- ...gmentFactoryReference(jsx=react-native).js | 16 -------------- ...FactoryReference(jsx=react-native).symbols | 13 ----------- ...ntFactoryReference(jsx=react-native).types | 20 ----------------- .../compiler/jsxFragmentFactoryReference.tsx | 2 ++ 16 files changed, 2 insertions(+), 254 deletions(-) delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).js delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).symbols delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).js delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).symbols delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).types delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).js delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).symbols delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).types delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).js delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).symbols delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).types delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).js delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).symbols delete mode 100644 tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).types diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).js b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).js deleted file mode 100644 index dc0e55b29d7b7..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).js +++ /dev/null @@ -1,16 +0,0 @@ -//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// - -//// [jsxFragmentFactoryReference.tsx] -export class LoggedOut { - content = () => ( - <> - ) -} - - -//// [jsxFragmentFactoryReference.jsx] -export class LoggedOut { - constructor() { - this.content = () => (<>); - } -} diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).symbols b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).symbols deleted file mode 100644 index aa071a7722864..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).symbols +++ /dev/null @@ -1,13 +0,0 @@ -//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// - -=== jsxFragmentFactoryReference.tsx === -export class LoggedOut { ->LoggedOut : Symbol(LoggedOut, Decl(jsxFragmentFactoryReference.tsx, 0, 0)) - - content = () => ( ->content : Symbol(LoggedOut.content, Decl(jsxFragmentFactoryReference.tsx, 0, 24)) - - <> - ) -} - diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types deleted file mode 100644 index e4560acb8822c..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types +++ /dev/null @@ -1,20 +0,0 @@ -//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// - -=== jsxFragmentFactoryReference.tsx === -export class LoggedOut { ->LoggedOut : LoggedOut -> : ^^^^^^^^^ - - content = () => ( ->content : () => any -> : ^^^^^^^^^ ->() => ( <> ) : () => any -> : ^^^^^^^^^ ->( <> ) : any - - <> -><> : any - - ) -} - diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).js b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).js deleted file mode 100644 index 9df51169ea47a..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).js +++ /dev/null @@ -1,16 +0,0 @@ -//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// - -//// [jsxFragmentFactoryReference.tsx] -export class LoggedOut { - content = () => ( - <> - ) -} - - -//// [jsxFragmentFactoryReference.js] -export class LoggedOut { - constructor() { - this.content = () => (React.createElement(React.Fragment, null)); - } -} diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).symbols b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).symbols deleted file mode 100644 index aa071a7722864..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).symbols +++ /dev/null @@ -1,13 +0,0 @@ -//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// - -=== jsxFragmentFactoryReference.tsx === -export class LoggedOut { ->LoggedOut : Symbol(LoggedOut, Decl(jsxFragmentFactoryReference.tsx, 0, 0)) - - content = () => ( ->content : Symbol(LoggedOut.content, Decl(jsxFragmentFactoryReference.tsx, 0, 24)) - - <> - ) -} - diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).types b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).types deleted file mode 100644 index f8d977761f572..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).types +++ /dev/null @@ -1,22 +0,0 @@ -//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// - -=== jsxFragmentFactoryReference.tsx === -export class LoggedOut { ->LoggedOut : LoggedOut -> : ^^^^^^^^^ - - content = () => ( ->content : () => any -> : ^^^^^^^^^ ->() => ( <> ) : () => any -> : ^^^^^^^^^ ->( <> ) : any -> : ^^^ - - <> -><> : any -> : ^^^ - - ) -} - diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).js b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).js deleted file mode 100644 index 4f12b96321745..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).js +++ /dev/null @@ -1,17 +0,0 @@ -//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// - -//// [jsxFragmentFactoryReference.tsx] -export class LoggedOut { - content = () => ( - <> - ) -} - - -//// [jsxFragmentFactoryReference.js] -import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime"; -export class LoggedOut { - constructor() { - this.content = () => (_jsx(_Fragment, {})); - } -} diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).symbols b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).symbols deleted file mode 100644 index aa071a7722864..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).symbols +++ /dev/null @@ -1,13 +0,0 @@ -//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// - -=== jsxFragmentFactoryReference.tsx === -export class LoggedOut { ->LoggedOut : Symbol(LoggedOut, Decl(jsxFragmentFactoryReference.tsx, 0, 0)) - - content = () => ( ->content : Symbol(LoggedOut.content, Decl(jsxFragmentFactoryReference.tsx, 0, 24)) - - <> - ) -} - diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).types b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).types deleted file mode 100644 index f8d977761f572..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).types +++ /dev/null @@ -1,22 +0,0 @@ -//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// - -=== jsxFragmentFactoryReference.tsx === -export class LoggedOut { ->LoggedOut : LoggedOut -> : ^^^^^^^^^ - - content = () => ( ->content : () => any -> : ^^^^^^^^^ ->() => ( <> ) : () => any -> : ^^^^^^^^^ ->( <> ) : any -> : ^^^ - - <> -><> : any -> : ^^^ - - ) -} - diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).js b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).js deleted file mode 100644 index e2fc59e87282c..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).js +++ /dev/null @@ -1,18 +0,0 @@ -//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// - -//// [jsxFragmentFactoryReference.tsx] -export class LoggedOut { - content = () => ( - <> - ) -} - - -//// [jsxFragmentFactoryReference.js] -import { Fragment as _Fragment, jsxDEV as _jsxDEV } from "react/jsx-dev-runtime"; -const _jsxFileName = "jsxFragmentFactoryReference.tsx"; -export class LoggedOut { - constructor() { - this.content = () => (_jsxDEV(_Fragment, {}, void 0, false, { fileName: _jsxFileName, lineNumber: 2, columnNumber: 22 }, this)); - } -} diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).symbols b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).symbols deleted file mode 100644 index aa071a7722864..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).symbols +++ /dev/null @@ -1,13 +0,0 @@ -//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// - -=== jsxFragmentFactoryReference.tsx === -export class LoggedOut { ->LoggedOut : Symbol(LoggedOut, Decl(jsxFragmentFactoryReference.tsx, 0, 0)) - - content = () => ( ->content : Symbol(LoggedOut.content, Decl(jsxFragmentFactoryReference.tsx, 0, 24)) - - <> - ) -} - diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).types b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).types deleted file mode 100644 index f8d977761f572..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsxdev).types +++ /dev/null @@ -1,22 +0,0 @@ -//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// - -=== jsxFragmentFactoryReference.tsx === -export class LoggedOut { ->LoggedOut : LoggedOut -> : ^^^^^^^^^ - - content = () => ( ->content : () => any -> : ^^^^^^^^^ ->() => ( <> ) : () => any -> : ^^^^^^^^^ ->( <> ) : any -> : ^^^ - - <> -><> : any -> : ^^^ - - ) -} - diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).js b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).js deleted file mode 100644 index 56011d7ec1fb6..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).js +++ /dev/null @@ -1,16 +0,0 @@ -//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// - -//// [jsxFragmentFactoryReference.tsx] -export class LoggedOut { - content = () => ( - <> - ) -} - - -//// [jsxFragmentFactoryReference.js] -export class LoggedOut { - constructor() { - this.content = () => (<>); - } -} diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).symbols b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).symbols deleted file mode 100644 index aa071a7722864..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).symbols +++ /dev/null @@ -1,13 +0,0 @@ -//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// - -=== jsxFragmentFactoryReference.tsx === -export class LoggedOut { ->LoggedOut : Symbol(LoggedOut, Decl(jsxFragmentFactoryReference.tsx, 0, 0)) - - content = () => ( ->content : Symbol(LoggedOut.content, Decl(jsxFragmentFactoryReference.tsx, 0, 24)) - - <> - ) -} - diff --git a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).types b/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).types deleted file mode 100644 index e4560acb8822c..0000000000000 --- a/tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-native).types +++ /dev/null @@ -1,20 +0,0 @@ -//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// - -=== jsxFragmentFactoryReference.tsx === -export class LoggedOut { ->LoggedOut : LoggedOut -> : ^^^^^^^^^ - - content = () => ( ->content : () => any -> : ^^^^^^^^^ ->() => ( <> ) : () => any -> : ^^^^^^^^^ ->( <> ) : any - - <> -><> : any - - ) -} - diff --git a/tests/cases/compiler/jsxFragmentFactoryReference.tsx b/tests/cases/compiler/jsxFragmentFactoryReference.tsx index de3431b1f7823..99f2fc118de87 100644 --- a/tests/cases/compiler/jsxFragmentFactoryReference.tsx +++ b/tests/cases/compiler/jsxFragmentFactoryReference.tsx @@ -1,3 +1,5 @@ +// @noTypesAndSymbols: true +// @noEmit: true // @jsx: preserve, react, react-jsx, react-jsxdev, react-native // @strict: true // @skipLibCheck: true