-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Remove reference not found errors from jsx: preserve
#60687
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// | ||
|
||
//// [jsxFragmentFactoryReference.tsx] | ||
export class LoggedOut { | ||
content = () => ( | ||
<> </> | ||
) | ||
} | ||
|
||
|
||
//// [jsxFragmentFactoryReference.jsx] | ||
export class LoggedOut { | ||
constructor() { | ||
this.content = () => (<> </>); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).symbols
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) | ||
|
||
<> </> | ||
) | ||
} | ||
|
20 changes: 20 additions & 0 deletions
20
tests/baselines/reference/jsxFragmentFactoryReference(jsx=preserve).types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// | ||
|
||
=== jsxFragmentFactoryReference.tsx === | ||
export class LoggedOut { | ||
>LoggedOut : LoggedOut | ||
> : ^^^^^^^^^ | ||
|
||
content = () => ( | ||
>content : () => any | ||
> : ^^^^^^^^^ | ||
>() => ( <> </> ) : () => any | ||
> : ^^^^^^^^^ | ||
>( <> </> ) : any | ||
|
||
<> </> | ||
><> </> : any | ||
|
||
) | ||
} | ||
|
15 changes: 15 additions & 0 deletions
15
tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).errors.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
) | ||
} | ||
|
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, " ")); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).symbols
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) | ||
|
||
<> </> | ||
) | ||
} | ||
|
22 changes: 22 additions & 0 deletions
22
tests/baselines/reference/jsxFragmentFactoryReference(jsx=react).types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// | ||
|
||
=== jsxFragmentFactoryReference.tsx === | ||
export class LoggedOut { | ||
>LoggedOut : LoggedOut | ||
> : ^^^^^^^^^ | ||
|
||
content = () => ( | ||
>content : () => any | ||
> : ^^^^^^^^^ | ||
>() => ( <> </> ) : () => any | ||
> : ^^^^^^^^^ | ||
>( <> </> ) : any | ||
> : ^^^ | ||
|
||
<> </> | ||
><> </> : any | ||
> : ^^^ | ||
|
||
) | ||
} | ||
|
15 changes: 15 additions & 0 deletions
15
tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).errors.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
) | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: " " })); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).symbols
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) | ||
|
||
<> </> | ||
) | ||
} | ||
|
22 changes: 22 additions & 0 deletions
22
tests/baselines/reference/jsxFragmentFactoryReference(jsx=react-jsx).types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//// [tests/cases/compiler/jsxFragmentFactoryReference.tsx] //// | ||
|
||
=== jsxFragmentFactoryReference.tsx === | ||
export class LoggedOut { | ||
>LoggedOut : LoggedOut | ||
> : ^^^^^^^^^ | ||
|
||
content = () => ( | ||
>content : () => any | ||
> : ^^^^^^^^^ | ||
>() => ( <> </> ) : () => any | ||
> : ^^^^^^^^^ | ||
>( <> </> ) : any | ||
> : ^^^ | ||
|
||
<> </> | ||
><> </> : any | ||
> : ^^^ | ||
|
||
) | ||
} | ||
|
88 changes: 88 additions & 0 deletions
88
tests/baselines/reference/jsxRuntimePragma(jsx=preserve).js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
//// [tests/cases/compiler/jsxRuntimePragma.ts] //// | ||
|
||
//// [one.tsx] | ||
/// <reference path="/.lib/react16.d.ts" /> | ||
/* @jsxRuntime classic */ | ||
import * as React from "react"; | ||
export const HelloWorld = () => <h1>Hello world</h1>; | ||
export const frag = <><div></div></>; | ||
export const selfClosing = <img src="./image.png" />; | ||
//// [two.tsx] | ||
/// <reference path="/.lib/react16.d.ts" /> | ||
/* @jsxRuntime automatic */ | ||
export const HelloWorld = () => <h1>Hello world</h1>; | ||
export const frag = <><div></div></>; | ||
export const selfClosing = <img src="./image.png" />; | ||
//// [three.tsx] | ||
/// <reference path="/.lib/react16.d.ts" /> | ||
/* @jsxRuntime classic */ | ||
/* @jsxRuntime automatic */ | ||
export const HelloWorld = () => <h1>Hello world</h1>; | ||
export const frag = <><div></div></>; | ||
export const selfClosing = <img src="./image.png" />; | ||
//// [four.tsx] | ||
/// <reference path="/.lib/react16.d.ts" /> | ||
/* @jsxRuntime automatic */ | ||
/* @jsxRuntime classic */ | ||
import * as React from "react"; | ||
export const HelloWorld = () => <h1>Hello world</h1>; | ||
export const frag = <><div></div></>; | ||
export const selfClosing = <img src="./image.png" />; | ||
//// [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; | ||
/// <reference path="react16.d.ts" /> | ||
/* @jsxRuntime classic */ | ||
var React = require("react"); | ||
var HelloWorld = function () { return <h1>Hello world</h1>; }; | ||
exports.HelloWorld = HelloWorld; | ||
exports.frag = <><div></div></>; | ||
exports.selfClosing = <img src="./image.png"/>; | ||
//// [two.jsx] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.selfClosing = exports.frag = exports.HelloWorld = void 0; | ||
/// <reference path="react16.d.ts" /> | ||
/* @jsxRuntime automatic */ | ||
var HelloWorld = function () { return <h1>Hello world</h1>; }; | ||
exports.HelloWorld = HelloWorld; | ||
exports.frag = <><div></div></>; | ||
exports.selfClosing = <img src="./image.png"/>; | ||
//// [three.jsx] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.selfClosing = exports.frag = exports.HelloWorld = void 0; | ||
/// <reference path="react16.d.ts" /> | ||
/* @jsxRuntime classic */ | ||
/* @jsxRuntime automatic */ | ||
var HelloWorld = function () { return <h1>Hello world</h1>; }; | ||
exports.HelloWorld = HelloWorld; | ||
exports.frag = <><div></div></>; | ||
exports.selfClosing = <img src="./image.png"/>; | ||
//// [four.jsx] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.selfClosing = exports.frag = exports.HelloWorld = void 0; | ||
/// <reference path="react16.d.ts" /> | ||
/* @jsxRuntime automatic */ | ||
/* @jsxRuntime classic */ | ||
var React = require("react"); | ||
var HelloWorld = function () { return <h1>Hello world</h1>; }; | ||
exports.HelloWorld = HelloWorld; | ||
exports.frag = <><div></div></>; | ||
exports.selfClosing = <img src="./image.png"/>; | ||
//// [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"); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.