mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
reset soft with master for single commit (#38720)
This commit is contained in:
parent
c3c6be6618
commit
f697d26ca1
@ -954,16 +954,32 @@ namespace ts {
|
||||
if (location) {
|
||||
const file = getSourceFileOfNode(location);
|
||||
if (file) {
|
||||
if (file.localJsxNamespace) {
|
||||
return file.localJsxNamespace;
|
||||
if (isJsxOpeningFragment(location)) {
|
||||
if (file.localJsxFragmentNamespace) {
|
||||
return file.localJsxFragmentNamespace;
|
||||
}
|
||||
const jsxFragmentPragma = file.pragmas.get("jsxfrag");
|
||||
if (jsxFragmentPragma) {
|
||||
const chosenPragma = isArray(jsxFragmentPragma) ? jsxFragmentPragma[0] : jsxFragmentPragma;
|
||||
file.localJsxFragmentFactory = parseIsolatedEntityName(chosenPragma.arguments.factory, languageVersion);
|
||||
visitNode(file.localJsxFragmentFactory, markAsSynthetic);
|
||||
if (file.localJsxFragmentFactory) {
|
||||
return file.localJsxFragmentNamespace = getFirstIdentifier(file.localJsxFragmentFactory).escapedText;
|
||||
}
|
||||
}
|
||||
}
|
||||
const jsxPragma = file.pragmas.get("jsx");
|
||||
if (jsxPragma) {
|
||||
const chosenpragma = isArray(jsxPragma) ? jsxPragma[0] : jsxPragma;
|
||||
file.localJsxFactory = parseIsolatedEntityName(chosenpragma.arguments.factory, languageVersion);
|
||||
visitNode(file.localJsxFactory, markAsSynthetic);
|
||||
if (file.localJsxFactory) {
|
||||
return file.localJsxNamespace = getFirstIdentifier(file.localJsxFactory).escapedText;
|
||||
else {
|
||||
if (file.localJsxNamespace) {
|
||||
return file.localJsxNamespace;
|
||||
}
|
||||
const jsxPragma = file.pragmas.get("jsx");
|
||||
if (jsxPragma) {
|
||||
const chosenPragma = isArray(jsxPragma) ? jsxPragma[0] : jsxPragma;
|
||||
file.localJsxFactory = parseIsolatedEntityName(chosenPragma.arguments.factory, languageVersion);
|
||||
visitNode(file.localJsxFactory, markAsSynthetic);
|
||||
if (file.localJsxFactory) {
|
||||
return file.localJsxNamespace = getFirstIdentifier(file.localJsxFactory).escapedText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -23736,10 +23752,14 @@ namespace ts {
|
||||
function checkJsxFragment(node: JsxFragment): Type {
|
||||
checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment);
|
||||
|
||||
if (compilerOptions.jsx === JsxEmit.React && (compilerOptions.jsxFactory || getSourceFileOfNode(node).pragmas.has("jsx"))) {
|
||||
// by default, jsx:'react' will use jsxFactory = React.createElement and jsxFragmentFactory = React.Fragment
|
||||
// if jsxFactory compiler option is provided, ensure jsxFragmentFactory compiler option or @jsxFrag pragma is provided too
|
||||
const nodeSourceFile = getSourceFileOfNode(node);
|
||||
if (compilerOptions.jsx === JsxEmit.React && (compilerOptions.jsxFactory || nodeSourceFile.pragmas.has("jsx"))
|
||||
&& !compilerOptions.jsxFragmentFactory && !nodeSourceFile.pragmas.has("jsxfrag")) {
|
||||
error(node, compilerOptions.jsxFactory
|
||||
? Diagnostics.JSX_fragment_is_not_supported_when_using_jsxFactory
|
||||
: Diagnostics.JSX_fragment_is_not_supported_when_using_an_inline_JSX_factory_pragma);
|
||||
? Diagnostics.The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option
|
||||
: Diagnostics.An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments);
|
||||
}
|
||||
|
||||
checkJsxChildren(node);
|
||||
@ -24197,21 +24217,28 @@ namespace ts {
|
||||
if (isNodeOpeningLikeElement) {
|
||||
checkGrammarJsxElement(<JsxOpeningLikeElement>node);
|
||||
}
|
||||
|
||||
checkJsxPreconditions(node);
|
||||
// The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
|
||||
// And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
|
||||
const reactRefErr = diagnostics && compilerOptions.jsx === JsxEmit.React ? Diagnostics.Cannot_find_name_0 : undefined;
|
||||
const reactNamespace = getJsxNamespace(node);
|
||||
const reactLocation = isNodeOpeningLikeElement ? (<JsxOpeningLikeElement>node).tagName : node;
|
||||
const reactSym = resolveName(reactLocation, reactNamespace, SymbolFlags.Value, reactRefErr, reactNamespace, /*isUse*/ true);
|
||||
if (reactSym) {
|
||||
// Mark local symbol as referenced here because it might not have been marked
|
||||
// if jsx emit was not react as there wont be error being emitted
|
||||
reactSym.isReferenced = SymbolFlags.All;
|
||||
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === JsxEmit.React ? Diagnostics.Cannot_find_name_0 : undefined;
|
||||
const jsxFactoryNamespace = getJsxNamespace(node);
|
||||
const jsxFactoryLocation = isNodeOpeningLikeElement ? (<JsxOpeningLikeElement>node).tagName : node;
|
||||
|
||||
// If react symbol is alias, mark it as referenced
|
||||
if (reactSym.flags & SymbolFlags.Alias && !getTypeOnlyAliasDeclaration(reactSym)) {
|
||||
markAliasSymbolAsReferenced(reactSym);
|
||||
// allow null as jsxFragmentFactory
|
||||
let jsxFactorySym: Symbol | undefined;
|
||||
if (!(isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
|
||||
jsxFactorySym = resolveName(jsxFactoryLocation, jsxFactoryNamespace, SymbolFlags.Value, jsxFactoryRefErr, jsxFactoryNamespace, /*isUse*/ true);
|
||||
}
|
||||
|
||||
if (jsxFactorySym) {
|
||||
// Mark local symbol as referenced here because it might not have been marked
|
||||
// if jsx emit was not jsxFactory as there wont be error being emitted
|
||||
jsxFactorySym.isReferenced = SymbolFlags.All;
|
||||
|
||||
// If react/jsxFactory symbol is alias, mark it as refereced
|
||||
if (jsxFactorySym.flags & SymbolFlags.Alias && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
||||
markAliasSymbolAsReferenced(jsxFactorySym);
|
||||
}
|
||||
}
|
||||
|
||||
@ -36728,10 +36755,31 @@ namespace ts {
|
||||
return literalTypeToNode(<FreshableType>type, node, tracker);
|
||||
}
|
||||
|
||||
function getJsxFactoryEntity(location: Node) {
|
||||
function getJsxFactoryEntity(location: Node): EntityName | undefined {
|
||||
return location ? (getJsxNamespace(location), (getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity;
|
||||
}
|
||||
|
||||
function getJsxFragmentFactoryEntity(location: Node): EntityName | undefined {
|
||||
if (location) {
|
||||
const file = getSourceFileOfNode(location);
|
||||
if (file) {
|
||||
if (file.localJsxFragmentFactory) {
|
||||
return file.localJsxFragmentFactory;
|
||||
}
|
||||
const jsxFragPragmas = file.pragmas.get("jsxfrag");
|
||||
const jsxFragPragma = isArray(jsxFragPragmas) ? jsxFragPragmas[0] : jsxFragPragmas;
|
||||
if (jsxFragPragma) {
|
||||
file.localJsxFragmentFactory = parseIsolatedEntityName(jsxFragPragma.arguments.factory, languageVersion);
|
||||
return file.localJsxFragmentFactory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (compilerOptions.jsxFragmentFactory) {
|
||||
return parseIsolatedEntityName(compilerOptions.jsxFragmentFactory, languageVersion);
|
||||
}
|
||||
}
|
||||
|
||||
function createResolver(): EmitResolver {
|
||||
// this variable and functions that use it are deliberately moved here from the outer scope
|
||||
// to avoid scope pollution
|
||||
@ -36806,6 +36854,7 @@ namespace ts {
|
||||
return !!(symbol && getCheckFlags(symbol) & CheckFlags.Late);
|
||||
},
|
||||
getJsxFactoryEntity,
|
||||
getJsxFragmentFactoryEntity,
|
||||
getAllAccessorDeclarations(accessor: AccessorDeclaration): AllAccessorDeclarations {
|
||||
accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration)!; // TODO: GH#18217
|
||||
const otherKind = accessor.kind === SyntaxKind.SetAccessor ? SyntaxKind.GetAccessor : SyntaxKind.SetAccessor;
|
||||
|
||||
@ -766,6 +766,12 @@ namespace ts {
|
||||
category: Diagnostics.Advanced_Options,
|
||||
description: Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h
|
||||
},
|
||||
{
|
||||
name: "jsxFragmentFactory",
|
||||
type: "string",
|
||||
category: Diagnostics.Advanced_Options,
|
||||
description: Diagnostics.Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compiler_option_is_specified_e_g_Fragment
|
||||
},
|
||||
{
|
||||
name: "resolveJsonModule",
|
||||
type: "boolean",
|
||||
|
||||
@ -5027,11 +5027,11 @@
|
||||
"category": "Error",
|
||||
"code": 17015
|
||||
},
|
||||
"JSX fragment is not supported when using --jsxFactory": {
|
||||
"The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.": {
|
||||
"category": "Error",
|
||||
"code": 17016
|
||||
},
|
||||
"JSX fragment is not supported when using an inline JSX factory pragma": {
|
||||
"An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments.": {
|
||||
"category": "Error",
|
||||
"code": 17017
|
||||
},
|
||||
@ -5837,5 +5837,13 @@
|
||||
"Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.": {
|
||||
"category": "Error",
|
||||
"code": 18033
|
||||
},
|
||||
"Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'.": {
|
||||
"category": "Message",
|
||||
"code": 18034
|
||||
},
|
||||
"Invalid value for 'jsxFragmentFactory'. '{0}' is not a valid identifier or qualified-name.": {
|
||||
"category": "Error",
|
||||
"code": 18035
|
||||
}
|
||||
}
|
||||
|
||||
@ -660,6 +660,7 @@ namespace ts {
|
||||
getTypeReferenceDirectivesForSymbol: notImplemented,
|
||||
isLiteralConstDeclaration: notImplemented,
|
||||
getJsxFactoryEntity: notImplemented,
|
||||
getJsxFragmentFactoryEntity: notImplemented,
|
||||
getAllAccessorDeclarations: notImplemented,
|
||||
getSymbolOfExternalModuleSpecifier: notImplemented,
|
||||
isBindingCapturedByNode: notImplemented,
|
||||
|
||||
@ -55,6 +55,15 @@ namespace ts {
|
||||
);
|
||||
}
|
||||
|
||||
function createJsxFragmentFactoryExpression(factory: NodeFactory, jsxFragmentFactoryEntity: EntityName | undefined, reactNamespace: string, parent: JsxOpeningLikeElement | JsxOpeningFragment): Expression {
|
||||
return jsxFragmentFactoryEntity ?
|
||||
createJsxFactoryExpressionFromEntityName(factory, jsxFragmentFactoryEntity, parent) :
|
||||
factory.createPropertyAccessExpression(
|
||||
createReactNamespace(reactNamespace, parent),
|
||||
"Fragment"
|
||||
);
|
||||
}
|
||||
|
||||
export function createExpressionForJsxElement(factory: NodeFactory, jsxFactoryEntity: EntityName | undefined, reactNamespace: string, tagName: Expression, props: Expression | undefined, children: readonly Expression[] | undefined, parentElement: JsxOpeningLikeElement, location: TextRange): LeftHandSideExpression {
|
||||
const argumentsList = [tagName];
|
||||
if (props) {
|
||||
@ -87,14 +96,9 @@ namespace ts {
|
||||
);
|
||||
}
|
||||
|
||||
export function createExpressionForJsxFragment(factory: NodeFactory, jsxFactoryEntity: EntityName | undefined, reactNamespace: string, children: readonly Expression[], parentElement: JsxOpeningFragment, location: TextRange): LeftHandSideExpression {
|
||||
const tagName = factory.createPropertyAccessExpression(
|
||||
createReactNamespace(reactNamespace, parentElement),
|
||||
"Fragment"
|
||||
);
|
||||
|
||||
const argumentsList = [<Expression>tagName];
|
||||
argumentsList.push(factory.createNull());
|
||||
export function createExpressionForJsxFragment(factory: NodeFactory, jsxFactoryEntity: EntityName | undefined, jsxFragmentFactoryEntity: EntityName | undefined, reactNamespace: string, children: readonly Expression[], parentElement: JsxOpeningFragment, location: TextRange): LeftHandSideExpression {
|
||||
const tagName = createJsxFragmentFactoryExpression(factory, jsxFragmentFactoryEntity, reactNamespace, parentElement);
|
||||
const argumentsList = [tagName, factory.createNull()];
|
||||
|
||||
if (children && children.length > 0) {
|
||||
if (children.length > 1) {
|
||||
@ -820,4 +824,4 @@ namespace ts {
|
||||
export function isStaticModifier(node: Modifier): node is StaticKeyword {
|
||||
return node.kind === SyntaxKind.StaticKeyword;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8568,7 +8568,9 @@ namespace ts {
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "jsx": return; // Accessed directly
|
||||
case "jsx":
|
||||
case "jsxfrag":
|
||||
return; // Accessed directly
|
||||
default: Debug.fail("Unhandled pragma kind"); // Can this be made into an assertNever in the future?
|
||||
}
|
||||
});
|
||||
|
||||
@ -3196,6 +3196,15 @@ namespace ts {
|
||||
createOptionValueDiagnostic("reactNamespace", Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace);
|
||||
}
|
||||
|
||||
if (options.jsxFragmentFactory) {
|
||||
if (!options.jsxFactory) {
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "jsxFragmentFactory", "jsxFactory");
|
||||
}
|
||||
if (!parseIsolatedEntityName(options.jsxFragmentFactory, languageVersion)) {
|
||||
createOptionValueDiagnostic("jsxFragmentFactory", Diagnostics.Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFragmentFactory);
|
||||
}
|
||||
}
|
||||
|
||||
// If the emit is enabled make sure that every output file is unique and not overwriting any of the input files
|
||||
if (!options.noEmit && !options.suppressOutputPathCheck) {
|
||||
const emitHost = getEmitHost();
|
||||
|
||||
@ -142,6 +142,7 @@ namespace ts {
|
||||
const element = createExpressionForJsxFragment(
|
||||
factory,
|
||||
context.getEmitResolver().getJsxFactoryEntity(currentSourceFile),
|
||||
context.getEmitResolver().getJsxFragmentFactoryEntity(currentSourceFile),
|
||||
compilerOptions.reactNamespace!, // TODO: GH#18217
|
||||
mapDefined(children, transformJsxChildToExpression),
|
||||
node,
|
||||
|
||||
@ -3454,7 +3454,9 @@ namespace ts {
|
||||
/* @internal */ version: string;
|
||||
/* @internal */ pragmas: ReadonlyPragmaMap;
|
||||
/* @internal */ localJsxNamespace?: __String;
|
||||
/* @internal */ localJsxFragmentNamespace?: __String;
|
||||
/* @internal */ localJsxFactory?: EntityName;
|
||||
/* @internal */ localJsxFragmentFactory?: EntityName;
|
||||
|
||||
/* @internal */ exportedModulesFromDeclarationEmit?: ExportedModulesFromDeclarationEmit;
|
||||
}
|
||||
@ -4463,6 +4465,7 @@ namespace ts {
|
||||
getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): string[] | undefined;
|
||||
isLiteralConstDeclaration(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration): boolean;
|
||||
getJsxFactoryEntity(location?: Node): EntityName | undefined;
|
||||
getJsxFragmentFactoryEntity(location?: Node): EntityName | undefined;
|
||||
getAllAccessorDeclarations(declaration: AccessorDeclaration): AllAccessorDeclarations;
|
||||
getSymbolOfExternalModuleSpecifier(node: StringLiteralLike): Symbol | undefined;
|
||||
isBindingCapturedByNode(node: Node, decl: VariableDeclaration | BindingElement): boolean;
|
||||
@ -5681,6 +5684,7 @@ namespace ts {
|
||||
/* @internal */ pretty?: boolean;
|
||||
reactNamespace?: string;
|
||||
jsxFactory?: string;
|
||||
jsxFragmentFactory?: string;
|
||||
composite?: boolean;
|
||||
incremental?: boolean;
|
||||
tsBuildInfoFile?: string;
|
||||
@ -7928,6 +7932,10 @@ namespace ts {
|
||||
args: [{ name: "factory" }],
|
||||
kind: PragmaKindFlags.MultiLine
|
||||
},
|
||||
"jsxfrag": {
|
||||
args: [{ name: "factory" }],
|
||||
kind: PragmaKindFlags.MultiLine
|
||||
},
|
||||
} as const;
|
||||
|
||||
/* @internal */
|
||||
|
||||
@ -363,6 +363,10 @@ var x = 0;`, {
|
||||
options: { compilerOptions: { jsxFactory: "createElement" }, fileName: "input.js", reportDiagnostics: true }
|
||||
});
|
||||
|
||||
transpilesCorrectly("Supports setting 'jsxFragmentFactory'", "x;", {
|
||||
options: { compilerOptions: { jsxFactory: "x", jsxFragmentFactory: "frag" }, fileName: "input.js", reportDiagnostics: true }
|
||||
});
|
||||
|
||||
transpilesCorrectly("Supports setting 'removeComments'", "x;", {
|
||||
options: { compilerOptions: { removeComments: true }, fileName: "input.js", reportDiagnostics: true }
|
||||
});
|
||||
|
||||
@ -2770,6 +2770,7 @@ declare namespace ts {
|
||||
project?: string;
|
||||
reactNamespace?: string;
|
||||
jsxFactory?: string;
|
||||
jsxFragmentFactory?: string;
|
||||
composite?: boolean;
|
||||
incremental?: boolean;
|
||||
tsBuildInfoFile?: string;
|
||||
|
||||
@ -2770,6 +2770,7 @@ declare namespace ts {
|
||||
project?: string;
|
||||
reactNamespace?: string;
|
||||
jsxFactory?: string;
|
||||
jsxFragmentFactory?: string;
|
||||
composite?: boolean;
|
||||
incremental?: boolean;
|
||||
tsBuildInfoFile?: string;
|
||||
|
||||
46
tests/baselines/reference/inlineJsxAndJsxFragPragma.js
Normal file
46
tests/baselines/reference/inlineJsxAndJsxFragPragma.js
Normal file
@ -0,0 +1,46 @@
|
||||
//// [tests/cases/conformance/jsx/inline/inlineJsxAndJsxFragPragma.tsx] ////
|
||||
|
||||
//// [renderer.d.ts]
|
||||
declare global {
|
||||
namespace JSX {
|
||||
interface IntrinsicElements {
|
||||
[e: string]: any;
|
||||
}
|
||||
}
|
||||
}
|
||||
export function h(): void;
|
||||
export function jsx(): void;
|
||||
export function Fragment(): void;
|
||||
|
||||
//// [preacty.tsx]
|
||||
/**
|
||||
* @jsx h
|
||||
* @jsxFrag Fragment
|
||||
*/
|
||||
import {h, Fragment} from "./renderer";
|
||||
<><div></div></>
|
||||
|
||||
//// [snabbdomy.tsx]
|
||||
/* @jsx jsx */
|
||||
/* @jsxfrag null */
|
||||
import {jsx} from "./renderer";
|
||||
<><span></span></>
|
||||
|
||||
//// [preacty.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
/**
|
||||
* @jsx h
|
||||
* @jsxFrag Fragment
|
||||
*/
|
||||
var renderer_1 = require("./renderer");
|
||||
renderer_1.h(renderer_1.Fragment, null,
|
||||
renderer_1.h("div", null));
|
||||
//// [snabbdomy.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
/* @jsx jsx */
|
||||
/* @jsxfrag null */
|
||||
var renderer_1 = require("./renderer");
|
||||
renderer_1.jsx(null, null,
|
||||
renderer_1.jsx("span", null));
|
||||
47
tests/baselines/reference/inlineJsxAndJsxFragPragma.symbols
Normal file
47
tests/baselines/reference/inlineJsxAndJsxFragPragma.symbols
Normal file
@ -0,0 +1,47 @@
|
||||
=== tests/cases/conformance/jsx/inline/renderer.d.ts ===
|
||||
declare global {
|
||||
>global : Symbol(global, Decl(renderer.d.ts, 0, 0))
|
||||
|
||||
namespace JSX {
|
||||
>JSX : Symbol(JSX, Decl(renderer.d.ts, 0, 16))
|
||||
|
||||
interface IntrinsicElements {
|
||||
>IntrinsicElements : Symbol(IntrinsicElements, Decl(renderer.d.ts, 1, 19))
|
||||
|
||||
[e: string]: any;
|
||||
>e : Symbol(e, Decl(renderer.d.ts, 3, 13))
|
||||
}
|
||||
}
|
||||
}
|
||||
export function h(): void;
|
||||
>h : Symbol(h, Decl(renderer.d.ts, 6, 1))
|
||||
|
||||
export function jsx(): void;
|
||||
>jsx : Symbol(jsx, Decl(renderer.d.ts, 7, 26))
|
||||
|
||||
export function Fragment(): void;
|
||||
>Fragment : Symbol(Fragment, Decl(renderer.d.ts, 8, 28))
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/preacty.tsx ===
|
||||
/**
|
||||
* @jsx h
|
||||
* @jsxFrag Fragment
|
||||
*/
|
||||
import {h, Fragment} from "./renderer";
|
||||
>h : Symbol(h, Decl(preacty.tsx, 4, 8))
|
||||
>Fragment : Symbol(Fragment, Decl(preacty.tsx, 4, 10))
|
||||
|
||||
<><div></div></>
|
||||
>div : Symbol(JSX.IntrinsicElements, Decl(renderer.d.ts, 1, 19))
|
||||
>div : Symbol(JSX.IntrinsicElements, Decl(renderer.d.ts, 1, 19))
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/snabbdomy.tsx ===
|
||||
/* @jsx jsx */
|
||||
/* @jsxfrag null */
|
||||
import {jsx} from "./renderer";
|
||||
>jsx : Symbol(jsx, Decl(snabbdomy.tsx, 2, 8))
|
||||
|
||||
<><span></span></>
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(renderer.d.ts, 1, 19))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(renderer.d.ts, 1, 19))
|
||||
|
||||
47
tests/baselines/reference/inlineJsxAndJsxFragPragma.types
Normal file
47
tests/baselines/reference/inlineJsxAndJsxFragPragma.types
Normal file
@ -0,0 +1,47 @@
|
||||
=== tests/cases/conformance/jsx/inline/renderer.d.ts ===
|
||||
declare global {
|
||||
>global : any
|
||||
|
||||
namespace JSX {
|
||||
interface IntrinsicElements {
|
||||
[e: string]: any;
|
||||
>e : string
|
||||
}
|
||||
}
|
||||
}
|
||||
export function h(): void;
|
||||
>h : () => void
|
||||
|
||||
export function jsx(): void;
|
||||
>jsx : () => void
|
||||
|
||||
export function Fragment(): void;
|
||||
>Fragment : () => void
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/preacty.tsx ===
|
||||
/**
|
||||
* @jsx h
|
||||
* @jsxFrag Fragment
|
||||
*/
|
||||
import {h, Fragment} from "./renderer";
|
||||
>h : () => void
|
||||
>Fragment : () => void
|
||||
|
||||
<><div></div></>
|
||||
><><div></div></> : error
|
||||
><div></div> : error
|
||||
>div : any
|
||||
>div : any
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/snabbdomy.tsx ===
|
||||
/* @jsx jsx */
|
||||
/* @jsxfrag null */
|
||||
import {jsx} from "./renderer";
|
||||
>jsx : () => void
|
||||
|
||||
<><span></span></>
|
||||
><><span></span></> : error
|
||||
><span></span> : error
|
||||
>span : any
|
||||
>span : any
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
//// [tests/cases/conformance/jsx/inline/inlineJsxAndJsxFragPragmaOverridesCompilerOptions.tsx] ////
|
||||
|
||||
//// [react.d.ts]
|
||||
declare global {
|
||||
namespace JSX {
|
||||
interface IntrinsicElements {
|
||||
[e: string]: any;
|
||||
}
|
||||
}
|
||||
}
|
||||
export function createElement(): void;
|
||||
export function Fragment(): void;
|
||||
|
||||
//// [preact.d.ts]
|
||||
export function h(): void;
|
||||
export function Frag(): void;
|
||||
|
||||
//// [snabbdom.d.ts]
|
||||
export function h(): void;
|
||||
|
||||
//// [reacty.tsx]
|
||||
import {createElement, Fragment} from "./react";
|
||||
<><span></span></>
|
||||
|
||||
//// [preacty.tsx]
|
||||
/**
|
||||
* @jsx h
|
||||
* @jsxFrag Frag
|
||||
*/
|
||||
import {h, Frag} from "./preact";
|
||||
<><div></div></>
|
||||
|
||||
//// [snabbdomy.tsx]
|
||||
/**
|
||||
* @jsx h
|
||||
* @jsxfrag null
|
||||
*/
|
||||
import {h} from "./snabbdom";
|
||||
<><div></div></>
|
||||
|
||||
//// [mix-n-match.tsx]
|
||||
/* @jsx h */
|
||||
/* @jsxFrag Fragment */
|
||||
import {h} from "./preact";
|
||||
import {Fragment} from "./react";
|
||||
<><span></span></>
|
||||
|
||||
//// [reacty.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var react_1 = require("./react");
|
||||
react_1.createElement(react_1.Fragment, null,
|
||||
react_1.createElement("span", null));
|
||||
//// [preacty.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
/**
|
||||
* @jsx h
|
||||
* @jsxFrag Frag
|
||||
*/
|
||||
var preact_1 = require("./preact");
|
||||
preact_1.h(preact_1.Frag, null,
|
||||
preact_1.h("div", null));
|
||||
//// [snabbdomy.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
/**
|
||||
* @jsx h
|
||||
* @jsxfrag null
|
||||
*/
|
||||
var snabbdom_1 = require("./snabbdom");
|
||||
snabbdom_1.h(null, null,
|
||||
snabbdom_1.h("div", null));
|
||||
//// [mix-n-match.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
/* @jsx h */
|
||||
/* @jsxFrag Fragment */
|
||||
var preact_1 = require("./preact");
|
||||
var react_1 = require("./react");
|
||||
preact_1.h(react_1.Fragment, null,
|
||||
preact_1.h("span", null));
|
||||
@ -0,0 +1,79 @@
|
||||
=== tests/cases/conformance/jsx/inline/react.d.ts ===
|
||||
declare global {
|
||||
>global : Symbol(global, Decl(react.d.ts, 0, 0))
|
||||
|
||||
namespace JSX {
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 0, 16))
|
||||
|
||||
interface IntrinsicElements {
|
||||
>IntrinsicElements : Symbol(IntrinsicElements, Decl(react.d.ts, 1, 19))
|
||||
|
||||
[e: string]: any;
|
||||
>e : Symbol(e, Decl(react.d.ts, 3, 13))
|
||||
}
|
||||
}
|
||||
}
|
||||
export function createElement(): void;
|
||||
>createElement : Symbol(createElement, Decl(react.d.ts, 6, 1))
|
||||
|
||||
export function Fragment(): void;
|
||||
>Fragment : Symbol(Fragment, Decl(react.d.ts, 7, 38))
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/preact.d.ts ===
|
||||
export function h(): void;
|
||||
>h : Symbol(h, Decl(preact.d.ts, 0, 0))
|
||||
|
||||
export function Frag(): void;
|
||||
>Frag : Symbol(Frag, Decl(preact.d.ts, 0, 26))
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/snabbdom.d.ts ===
|
||||
export function h(): void;
|
||||
>h : Symbol(h, Decl(snabbdom.d.ts, 0, 0))
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/reacty.tsx ===
|
||||
import {createElement, Fragment} from "./react";
|
||||
>createElement : Symbol(createElement, Decl(reacty.tsx, 0, 8))
|
||||
>Fragment : Symbol(Fragment, Decl(reacty.tsx, 0, 22))
|
||||
|
||||
<><span></span></>
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(react.d.ts, 1, 19))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(react.d.ts, 1, 19))
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/preacty.tsx ===
|
||||
/**
|
||||
* @jsx h
|
||||
* @jsxFrag Frag
|
||||
*/
|
||||
import {h, Frag} from "./preact";
|
||||
>h : Symbol(h, Decl(preacty.tsx, 4, 8))
|
||||
>Frag : Symbol(Frag, Decl(preacty.tsx, 4, 10))
|
||||
|
||||
<><div></div></>
|
||||
>div : Symbol(JSX.IntrinsicElements, Decl(react.d.ts, 1, 19))
|
||||
>div : Symbol(JSX.IntrinsicElements, Decl(react.d.ts, 1, 19))
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/snabbdomy.tsx ===
|
||||
/**
|
||||
* @jsx h
|
||||
* @jsxfrag null
|
||||
*/
|
||||
import {h} from "./snabbdom";
|
||||
>h : Symbol(h, Decl(snabbdomy.tsx, 4, 8))
|
||||
|
||||
<><div></div></>
|
||||
>div : Symbol(JSX.IntrinsicElements, Decl(react.d.ts, 1, 19))
|
||||
>div : Symbol(JSX.IntrinsicElements, Decl(react.d.ts, 1, 19))
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/mix-n-match.tsx ===
|
||||
/* @jsx h */
|
||||
/* @jsxFrag Fragment */
|
||||
import {h} from "./preact";
|
||||
>h : Symbol(h, Decl(mix-n-match.tsx, 2, 8))
|
||||
|
||||
import {Fragment} from "./react";
|
||||
>Fragment : Symbol(Fragment, Decl(mix-n-match.tsx, 3, 8))
|
||||
|
||||
<><span></span></>
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(react.d.ts, 1, 19))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(react.d.ts, 1, 19))
|
||||
|
||||
@ -0,0 +1,83 @@
|
||||
=== tests/cases/conformance/jsx/inline/react.d.ts ===
|
||||
declare global {
|
||||
>global : any
|
||||
|
||||
namespace JSX {
|
||||
interface IntrinsicElements {
|
||||
[e: string]: any;
|
||||
>e : string
|
||||
}
|
||||
}
|
||||
}
|
||||
export function createElement(): void;
|
||||
>createElement : () => void
|
||||
|
||||
export function Fragment(): void;
|
||||
>Fragment : () => void
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/preact.d.ts ===
|
||||
export function h(): void;
|
||||
>h : () => void
|
||||
|
||||
export function Frag(): void;
|
||||
>Frag : () => void
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/snabbdom.d.ts ===
|
||||
export function h(): void;
|
||||
>h : () => void
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/reacty.tsx ===
|
||||
import {createElement, Fragment} from "./react";
|
||||
>createElement : () => void
|
||||
>Fragment : () => void
|
||||
|
||||
<><span></span></>
|
||||
><><span></span></> : error
|
||||
><span></span> : error
|
||||
>span : any
|
||||
>span : any
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/preacty.tsx ===
|
||||
/**
|
||||
* @jsx h
|
||||
* @jsxFrag Frag
|
||||
*/
|
||||
import {h, Frag} from "./preact";
|
||||
>h : () => void
|
||||
>Frag : () => void
|
||||
|
||||
<><div></div></>
|
||||
><><div></div></> : error
|
||||
><div></div> : error
|
||||
>div : any
|
||||
>div : any
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/snabbdomy.tsx ===
|
||||
/**
|
||||
* @jsx h
|
||||
* @jsxfrag null
|
||||
*/
|
||||
import {h} from "./snabbdom";
|
||||
>h : () => void
|
||||
|
||||
<><div></div></>
|
||||
><><div></div></> : error
|
||||
><div></div> : error
|
||||
>div : any
|
||||
>div : any
|
||||
|
||||
=== tests/cases/conformance/jsx/inline/mix-n-match.tsx ===
|
||||
/* @jsx h */
|
||||
/* @jsxFrag Fragment */
|
||||
import {h} from "./preact";
|
||||
>h : () => void
|
||||
|
||||
import {Fragment} from "./react";
|
||||
>Fragment : () => void
|
||||
|
||||
<><span></span></>
|
||||
><><span></span></> : error
|
||||
><span></span> : error
|
||||
>span : any
|
||||
>span : any
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
tests/cases/conformance/jsx/inline/index.tsx(3,1): error TS17017: JSX fragment is not supported when using an inline JSX factory pragma
|
||||
tests/cases/conformance/jsx/inline/reacty.tsx(3,1): error TS17017: JSX fragment is not supported when using an inline JSX factory pragma
|
||||
tests/cases/conformance/jsx/inline/index.tsx(3,1): error TS2304: Cannot find name 'React'.
|
||||
tests/cases/conformance/jsx/inline/index.tsx(3,1): error TS17017: An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments.
|
||||
tests/cases/conformance/jsx/inline/reacty.tsx(3,1): error TS17017: An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/inline/renderer.d.ts (0 errors) ====
|
||||
@ -17,10 +18,12 @@ tests/cases/conformance/jsx/inline/reacty.tsx(3,1): error TS17017: JSX fragment
|
||||
import * as React from "./renderer";
|
||||
<><h></h></>
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS17017: JSX fragment is not supported when using an inline JSX factory pragma
|
||||
==== tests/cases/conformance/jsx/inline/index.tsx (1 errors) ====
|
||||
!!! error TS17017: An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments.
|
||||
==== tests/cases/conformance/jsx/inline/index.tsx (2 errors) ====
|
||||
/** @jsx dom */
|
||||
import { dom } from "./renderer";
|
||||
<><h></h></>
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'React'.
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS17017: JSX fragment is not supported when using an inline JSX factory pragma
|
||||
!!! error TS17017: An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments.
|
||||
@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/jsxFactoryAndFragment.tsx(3,1): error TS17016: JSX fragment is not supported when using --jsxFactory
|
||||
tests/cases/compiler/jsxFactoryAndFragment.tsx(4,1): error TS17016: JSX fragment is not supported when using --jsxFactory
|
||||
tests/cases/compiler/jsxFactoryAndFragment.tsx(4,17): error TS17016: JSX fragment is not supported when using --jsxFactory
|
||||
tests/cases/compiler/jsxFactoryAndFragment.tsx(3,1): error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
|
||||
tests/cases/compiler/jsxFactoryAndFragment.tsx(4,1): error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
|
||||
tests/cases/compiler/jsxFactoryAndFragment.tsx(4,17): error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
|
||||
|
||||
|
||||
==== tests/cases/compiler/jsxFactoryAndFragment.tsx (3 errors) ====
|
||||
@ -8,9 +8,9 @@ tests/cases/compiler/jsxFactoryAndFragment.tsx(4,17): error TS17016: JSX fragmen
|
||||
|
||||
<></>;
|
||||
~~~~~
|
||||
!!! error TS17016: JSX fragment is not supported when using --jsxFactory
|
||||
!!! error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS17016: JSX fragment is not supported when using --jsxFactory
|
||||
!!! error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS17016: JSX fragment is not supported when using --jsxFactory
|
||||
!!! error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
|
||||
13
tests/baselines/reference/jsxFactoryAndJsxFragmentFactory.js
Normal file
13
tests/baselines/reference/jsxFactoryAndJsxFragmentFactory.js
Normal file
@ -0,0 +1,13 @@
|
||||
//// [jsxFactoryAndJsxFragmentFactory.tsx]
|
||||
declare var h: any;
|
||||
|
||||
<></>;
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
|
||||
//// [jsxFactoryAndJsxFragmentFactory.js]
|
||||
h(Frag, null);
|
||||
h(Frag, null,
|
||||
h("span", null, "1"),
|
||||
h(Frag, null,
|
||||
h("span", null, "2.1"),
|
||||
h("span", null, "2.2")));
|
||||
@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/jsxFactoryAndJsxFragmentFactory.tsx ===
|
||||
declare var h: any;
|
||||
>h : Symbol(h, Decl(jsxFactoryAndJsxFragmentFactory.tsx, 0, 11))
|
||||
|
||||
<></>;
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/jsxFactoryAndJsxFragmentFactory.tsx ===
|
||||
declare var h: any;
|
||||
>h : any
|
||||
|
||||
<></>;
|
||||
><></> : error
|
||||
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
><><span>1</span><><span>2.1</span><span>2.2</span></></> : error
|
||||
><span>1</span> : error
|
||||
>span : any
|
||||
>span : any
|
||||
><><span>2.1</span><span>2.2</span></> : error
|
||||
><span>2.1</span> : error
|
||||
>span : any
|
||||
>span : any
|
||||
><span>2.2</span> : error
|
||||
>span : any
|
||||
>span : any
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
error TS18035: Invalid value for 'jsxFragmentFactory'. '234' is not a valid identifier or qualified-name.
|
||||
|
||||
|
||||
!!! error TS18035: Invalid value for 'jsxFragmentFactory'. '234' is not a valid identifier or qualified-name.
|
||||
==== tests/cases/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.tsx (0 errors) ====
|
||||
declare var h: any;
|
||||
|
||||
<></>;
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
@ -0,0 +1,13 @@
|
||||
//// [jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.tsx]
|
||||
declare var h: any;
|
||||
|
||||
<></>;
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
|
||||
//// [jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.js]
|
||||
h(React.Fragment, null);
|
||||
h(React.Fragment, null,
|
||||
h("span", null, "1"),
|
||||
h(React.Fragment, null,
|
||||
h("span", null, "2.1"),
|
||||
h("span", null, "2.2")));
|
||||
@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.tsx ===
|
||||
declare var h: any;
|
||||
>h : Symbol(h, Decl(jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.tsx, 0, 11))
|
||||
|
||||
<></>;
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/jsxFactoryAndJsxFragmentFactoryErrorNotIdentifier.tsx ===
|
||||
declare var h: any;
|
||||
>h : any
|
||||
|
||||
<></>;
|
||||
><></> : any
|
||||
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
><><span>1</span><><span>2.1</span><span>2.2</span></></> : any
|
||||
><span>1</span> : any
|
||||
>span : any
|
||||
>span : any
|
||||
><><span>2.1</span><span>2.2</span></> : any
|
||||
><span>2.1</span> : any
|
||||
>span : any
|
||||
>span : any
|
||||
><span>2.2</span> : any
|
||||
>span : any
|
||||
>span : any
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
//// [jsxFactoryAndJsxFragmentFactoryNull.tsx]
|
||||
declare var h: any;
|
||||
|
||||
<></>;
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
|
||||
//// [jsxFactoryAndJsxFragmentFactoryNull.js]
|
||||
h(null, null);
|
||||
h(null, null,
|
||||
h("span", null, "1"),
|
||||
h(null, null,
|
||||
h("span", null, "2.1"),
|
||||
h("span", null, "2.2")));
|
||||
@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/jsxFactoryAndJsxFragmentFactoryNull.tsx ===
|
||||
declare var h: any;
|
||||
>h : Symbol(h, Decl(jsxFactoryAndJsxFragmentFactoryNull.tsx, 0, 11))
|
||||
|
||||
<></>;
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/jsxFactoryAndJsxFragmentFactoryNull.tsx ===
|
||||
declare var h: any;
|
||||
>h : any
|
||||
|
||||
<></>;
|
||||
><></> : error
|
||||
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
><><span>1</span><><span>2.1</span><span>2.2</span></></> : error
|
||||
><span>1</span> : error
|
||||
>span : any
|
||||
>span : any
|
||||
><><span>2.1</span><span>2.2</span></> : error
|
||||
><span>2.1</span> : error
|
||||
>span : any
|
||||
>span : any
|
||||
><span>2.2</span> : error
|
||||
>span : any
|
||||
>span : any
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
tests/cases/compiler/jsxFactoryButNoJsxFragmentFactory.tsx(3,1): error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
|
||||
tests/cases/compiler/jsxFactoryButNoJsxFragmentFactory.tsx(4,1): error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
|
||||
tests/cases/compiler/jsxFactoryButNoJsxFragmentFactory.tsx(4,17): error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
|
||||
|
||||
|
||||
==== tests/cases/compiler/jsxFactoryButNoJsxFragmentFactory.tsx (3 errors) ====
|
||||
declare var h: any;
|
||||
|
||||
<></>;
|
||||
~~~~~
|
||||
!!! error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS17016: The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.
|
||||
@ -0,0 +1,13 @@
|
||||
//// [jsxFactoryButNoJsxFragmentFactory.tsx]
|
||||
declare var h: any;
|
||||
|
||||
<></>;
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
|
||||
//// [jsxFactoryButNoJsxFragmentFactory.js]
|
||||
h(React.Fragment, null);
|
||||
h(React.Fragment, null,
|
||||
h("span", null, "1"),
|
||||
h(React.Fragment, null,
|
||||
h("span", null, "2.1"),
|
||||
h("span", null, "2.2")));
|
||||
@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/jsxFactoryButNoJsxFragmentFactory.tsx ===
|
||||
declare var h: any;
|
||||
>h : Symbol(h, Decl(jsxFactoryButNoJsxFragmentFactory.tsx, 0, 11))
|
||||
|
||||
<></>;
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/jsxFactoryButNoJsxFragmentFactory.tsx ===
|
||||
declare var h: any;
|
||||
>h : any
|
||||
|
||||
<></>;
|
||||
><></> : any
|
||||
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
><><span>1</span><><span>2.1</span><span>2.2</span></></> : any
|
||||
><span>1</span> : any
|
||||
>span : any
|
||||
>span : any
|
||||
><><span>2.1</span><span>2.2</span></> : any
|
||||
><span>2.1</span> : any
|
||||
>span : any
|
||||
>span : any
|
||||
><span>2.2</span> : any
|
||||
>span : any
|
||||
>span : any
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"jsxFragmentFactory": "someString"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
x;
|
||||
//# sourceMappingURL=input.js.map
|
||||
@ -0,0 +1,2 @@
|
||||
x;
|
||||
//# sourceMappingURL=input.js.map
|
||||
8
tests/cases/compiler/jsxFactoryAndJsxFragmentFactory.tsx
Normal file
8
tests/cases/compiler/jsxFactoryAndJsxFragmentFactory.tsx
Normal file
@ -0,0 +1,8 @@
|
||||
//@jsx: react
|
||||
//@jsxFactory: h
|
||||
//@jsxFragmentFactory: Frag
|
||||
|
||||
declare var h: any;
|
||||
|
||||
<></>;
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
@ -0,0 +1,8 @@
|
||||
//@jsx: react
|
||||
//@jsxFactory: h
|
||||
//@jsxFragmentFactory: 234
|
||||
|
||||
declare var h: any;
|
||||
|
||||
<></>;
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
@ -0,0 +1,8 @@
|
||||
//@jsx: react
|
||||
//@jsxFactory: h
|
||||
//@jsxFragmentFactory: null
|
||||
|
||||
declare var h: any;
|
||||
|
||||
<></>;
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></></>;
|
||||
@ -0,0 +1,26 @@
|
||||
// @jsx: react
|
||||
// @filename: renderer.d.ts
|
||||
declare global {
|
||||
namespace JSX {
|
||||
interface IntrinsicElements {
|
||||
[e: string]: any;
|
||||
}
|
||||
}
|
||||
}
|
||||
export function h(): void;
|
||||
export function jsx(): void;
|
||||
export function Fragment(): void;
|
||||
|
||||
// @filename: preacty.tsx
|
||||
/**
|
||||
* @jsx h
|
||||
* @jsxFrag Fragment
|
||||
*/
|
||||
import {h, Fragment} from "./renderer";
|
||||
<><div></div></>
|
||||
|
||||
// @filename: snabbdomy.tsx
|
||||
/* @jsx jsx */
|
||||
/* @jsxfrag null */
|
||||
import {jsx} from "./renderer";
|
||||
<><span></span></>
|
||||
@ -0,0 +1,48 @@
|
||||
// @jsx: react
|
||||
// @jsxFactory: createElement
|
||||
// @jsxFragmentFactory: Fragment
|
||||
|
||||
// @filename: react.d.ts
|
||||
declare global {
|
||||
namespace JSX {
|
||||
interface IntrinsicElements {
|
||||
[e: string]: any;
|
||||
}
|
||||
}
|
||||
}
|
||||
export function createElement(): void;
|
||||
export function Fragment(): void;
|
||||
|
||||
// @filename: preact.d.ts
|
||||
export function h(): void;
|
||||
export function Frag(): void;
|
||||
|
||||
// @filename: snabbdom.d.ts
|
||||
export function h(): void;
|
||||
|
||||
// @filename: reacty.tsx
|
||||
import {createElement, Fragment} from "./react";
|
||||
<><span></span></>
|
||||
|
||||
// @filename: preacty.tsx
|
||||
/**
|
||||
* @jsx h
|
||||
* @jsxFrag Frag
|
||||
*/
|
||||
import {h, Frag} from "./preact";
|
||||
<><div></div></>
|
||||
|
||||
// @filename: snabbdomy.tsx
|
||||
/**
|
||||
* @jsx h
|
||||
* @jsxfrag null
|
||||
*/
|
||||
import {h} from "./snabbdom";
|
||||
<><div></div></>
|
||||
|
||||
// @filename: mix-n-match.tsx
|
||||
/* @jsx h */
|
||||
/* @jsxFrag Fragment */
|
||||
import {h} from "./preact";
|
||||
import {Fragment} from "./react";
|
||||
<><span></span></>
|
||||
Loading…
x
Reference in New Issue
Block a user