-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add jsx fragments to callLikeExpression (#59933)
- Loading branch information
Showing
23 changed files
with
488 additions
and
167 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
49 changes: 49 additions & 0 deletions
49
tests/baselines/reference/inlineJsxAndJsxFragPragmaOverridesCompilerOptions.errors.txt
This file contains 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,49 @@ | ||
snabbdomy.tsx(6,1): error TS2879: Using JSX fragments requires fragment factory 'null' to be in scope, but it could not be found. | ||
|
||
|
||
==== react.d.ts (0 errors) ==== | ||
declare global { | ||
namespace JSX { | ||
interface IntrinsicElements { | ||
[e: string]: any; | ||
} | ||
} | ||
} | ||
export function createElement(): void; | ||
export function Fragment(): void; | ||
|
||
==== preact.d.ts (0 errors) ==== | ||
export function h(): void; | ||
export function Frag(): void; | ||
|
||
==== snabbdom.d.ts (0 errors) ==== | ||
export function h(): void; | ||
|
||
==== reacty.tsx (0 errors) ==== | ||
import {createElement, Fragment} from "./react"; | ||
<><span></span></> | ||
|
||
==== preacty.tsx (0 errors) ==== | ||
/** | ||
* @jsx h | ||
* @jsxFrag Frag | ||
*/ | ||
import {h, Frag} from "./preact"; | ||
<><div></div></> | ||
|
||
==== snabbdomy.tsx (1 errors) ==== | ||
/** | ||
* @jsx h | ||
* @jsxfrag null | ||
*/ | ||
import {h} from "./snabbdom"; | ||
<><div></div></> | ||
~~ | ||
!!! error TS2879: Using JSX fragments requires fragment factory 'null' to be in scope, but it could not be found. | ||
|
||
==== mix-n-match.tsx (0 errors) ==== | ||
/* @jsx h */ | ||
/* @jsxFrag Fragment */ | ||
import {h} from "./preact"; | ||
import {Fragment} from "./react"; | ||
<><span></span></> |
This file contains 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
This file contains 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
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/jsxFactoryAndJsxFragmentFactoryNull.errors.txt
This file contains 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,10 @@ | ||
jsxFactoryAndJsxFragmentFactoryNull.tsx(3,1): error TS2879: Using JSX fragments requires fragment factory 'null' to be in scope, but it could not be found. | ||
|
||
|
||
==== jsxFactoryAndJsxFragmentFactoryNull.tsx (1 errors) ==== | ||
declare var h: any; | ||
|
||
<></>; | ||
~~ | ||
!!! error TS2879: Using JSX fragments requires fragment factory 'null' to be in scope, but it could not be found. | ||
<><span>1</span><><span>2.1</span><span>2.2</span></></>; |
This file contains 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
This file contains 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 @@ | ||
a.tsx(6,28): error TS2322: Type '{ children: () => string; }' is not assignable to type '{ children?: ReactNode; }'. | ||
Types of property 'children' are incompatible. | ||
Type '() => string' is not assignable to type 'ReactNode'. | ||
a.tsx(7,47): error TS2322: Type '() => string' is not assignable to type 'ReactNode'. | ||
|
||
|
||
==== a.tsx (2 errors) ==== | ||
/// <reference path="/.lib/react18/react18.d.ts" /> | ||
/// <reference path="/.lib/react18/global.d.ts" /> | ||
|
||
const test = () => "asd"; | ||
|
||
const jsxWithJsxFragment = <>{test}</>; | ||
~~ | ||
!!! error TS2322: Type '{ children: () => string; }' is not assignable to type '{ children?: ReactNode; }'. | ||
!!! error TS2322: Types of property 'children' are incompatible. | ||
!!! error TS2322: Type '() => string' is not assignable to type 'ReactNode'. | ||
const jsxWithReactFragment = <React.Fragment>{test}</React.Fragment>; | ||
~~~~ | ||
!!! error TS2322: Type '() => string' is not assignable to type 'ReactNode'. | ||
!!! related TS6212 a.tsx:7:47: Did you mean to call this expression? | ||
|
Oops, something went wrong.