Skip to content

Commit 278f260

Browse files
Specialize the message on JSX tags looking for the JSX factory namespace (#58870)
1 parent e5758ab commit 278f260

File tree

42 files changed

+180
-117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+180
-117
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30132,7 +30132,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3013230132
if (!getJsxNamespaceContainerForImplicitImport(node)) {
3013330133
// The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import.
3013430134
// And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error.
30135-
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === JsxEmit.React ? Diagnostics.Cannot_find_name_0 : undefined;
30135+
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === JsxEmit.React ? Diagnostics.This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found : undefined;
3013630136
const jsxFactoryNamespace = getJsxNamespace(node);
3013730137
const jsxFactoryLocation = isJsxOpeningLikeElement(node) ? node.tagName : node;
3013830138

@@ -33438,7 +33438,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3343833438
const isClassic = getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Classic;
3343933439
const errorMessage = isClassic
3344033440
? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option
33441-
: Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
33441+
: Diagnostics.This_JSX_tag_requires_the_module_path_0_to_exist_but_none_could_be_found_Make_sure_you_have_types_for_the_appropriate_package_installed;
3344233442
const specifier = getJSXRuntimeImportSpecifier(file, runtimeImportSpecifier);
3344333443
const mod = resolveExternalModule(specifier || location!, runtimeImportSpecifier, errorMessage, location);
3344433444
const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : undefined;

src/compiler/diagnosticMessages.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3948,6 +3948,15 @@
39483948
"category": "Error",
39493949
"code": 2873
39503950
},
3951+
"This JSX tag requires '{0}' to be in scope, but it could not be found.": {
3952+
"category": "Error",
3953+
"code": 2874
3954+
},
3955+
"This JSX tag requires the module path '{0}' to exist, but none could be found. Make sure you have types for the appropriate package installed.": {
3956+
"category": "Error",
3957+
"code": 2875
3958+
},
3959+
39513960
"Import declaration '{0}' is using private name '{1}'.": {
39523961
"category": "Error",
39533962
"code": 4000

src/services/codefixes/fixCannotFindModule.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
import {
77
Debug,
88
Diagnostics,
9+
getJSXImplicitImportBase,
910
getTokenAtPosition,
1011
getTypesPackageName,
1112
InstallPackageAction,
@@ -22,17 +23,23 @@ const fixName = "fixCannotFindModule";
2223
const fixIdInstallTypesPackage = "installTypesPackage";
2324

2425
const errorCodeCannotFindModule = Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code;
26+
const errorCannotFindImplicitJsxImport = Diagnostics.This_JSX_tag_requires_the_module_path_0_to_exist_but_none_could_be_found_Make_sure_you_have_types_for_the_appropriate_package_installed.code;
2527
const errorCodes = [
2628
errorCodeCannotFindModule,
2729
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code,
30+
errorCannotFindImplicitJsxImport,
2831
];
2932
registerCodeFix({
3033
errorCodes,
3134
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
32-
const { host, sourceFile, span: { start } } = context;
33-
const packageName = tryGetImportedPackageName(sourceFile, start);
35+
const { host, sourceFile, span: { start }, errorCode } = context;
36+
37+
const packageName = errorCode === errorCannotFindImplicitJsxImport ?
38+
getJSXImplicitImportBase(context.program.getCompilerOptions(), sourceFile) :
39+
tryGetImportedPackageName(sourceFile, start);
3440
if (packageName === undefined) return undefined;
35-
const typesPackageName = getTypesPackageNameToInstall(packageName, host, context.errorCode);
41+
42+
const typesPackageName = getTypesPackageNameToInstall(packageName, host, errorCode);
3643
return typesPackageName === undefined
3744
? []
3845
: [createCodeFixAction(fixName, /*changes*/ [], [Diagnostics.Install_0, typesPackageName], fixIdInstallTypesPackage, Diagnostics.Install_all_missing_types_packages, getInstallCommand(sourceFile.fileName, typesPackageName))];

src/services/codefixes/importFixes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ const errorCodes: readonly number[] = [
180180
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode.code,
181181
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig.code,
182182
Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code,
183+
Diagnostics.This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found.code,
183184
];
184185

185186
registerCodeFix({

tests/baselines/reference/commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=auto).errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2304: Cannot find name 'React'.
1+
commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
22

33

44
==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ====
@@ -8,7 +8,7 @@ commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2304: Cannot find name '
88
render() {
99
return <div>
1010
~~~
11-
!!! error TS2304: Cannot find name 'React'.
11+
!!! error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
1212
{/* missing */}
1313
{null/* preserved */}
1414
{

tests/baselines/reference/commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=force).errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2304: Cannot find name 'React'.
1+
commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
22

33

44
==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ====
@@ -8,7 +8,7 @@ commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2304: Cannot find name '
88
render() {
99
return <div>
1010
~~~
11-
!!! error TS2304: Cannot find name 'React'.
11+
!!! error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
1212
{/* missing */}
1313
{null/* preserved */}
1414
{

tests/baselines/reference/commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=legacy).errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2304: Cannot find name 'React'.
1+
commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
22

33

44
==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ====
@@ -8,7 +8,7 @@ commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2304: Cannot find name '
88
render() {
99
return <div>
1010
~~~
11-
!!! error TS2304: Cannot find name 'React'.
11+
!!! error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
1212
{/* missing */}
1313
{null/* preserved */}
1414
{

tests/baselines/reference/commentsOnJSXExpressionsArePreserved(jsx=react,module=system,moduledetection=auto).errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2304: Cannot find name 'React'.
1+
commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
22

33

44
==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ====
@@ -8,7 +8,7 @@ commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2304: Cannot find name '
88
render() {
99
return <div>
1010
~~~
11-
!!! error TS2304: Cannot find name 'React'.
11+
!!! error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
1212
{/* missing */}
1313
{null/* preserved */}
1414
{

tests/baselines/reference/commentsOnJSXExpressionsArePreserved(jsx=react,module=system,moduledetection=force).errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2304: Cannot find name 'React'.
1+
commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
22

33

44
==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ====
@@ -8,7 +8,7 @@ commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2304: Cannot find name '
88
render() {
99
return <div>
1010
~~~
11-
!!! error TS2304: Cannot find name 'React'.
11+
!!! error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
1212
{/* missing */}
1313
{null/* preserved */}
1414
{

tests/baselines/reference/commentsOnJSXExpressionsArePreserved(jsx=react,module=system,moduledetection=legacy).errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2304: Cannot find name 'React'.
1+
commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
22

33

44
==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ====
@@ -8,7 +8,7 @@ commentsOnJSXExpressionsArePreserved.tsx(5,17): error TS2304: Cannot find name '
88
render() {
99
return <div>
1010
~~~
11-
!!! error TS2304: Cannot find name 'React'.
11+
!!! error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
1212
{/* missing */}
1313
{null/* preserved */}
1414
{

tests/baselines/reference/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=auto).errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2307: Cannot find module 'react/jsx-runtime' or its corresponding type declarations.
1+
commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed.
22

33

44
==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ====
@@ -34,6 +34,6 @@ commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2307: Cannot find module
3434
~~~~~~~~~~~~~~~~~~~~~~~~
3535
</div>;
3636
~~~~~~~~~~~~~~
37-
!!! error TS2307: Cannot find module 'react/jsx-runtime' or its corresponding type declarations.
37+
!!! error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed.
3838
}
3939
}

tests/baselines/reference/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2307: Cannot find module 'react/jsx-runtime' or its corresponding type declarations.
1+
commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed.
22

33

44
==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ====
@@ -34,6 +34,6 @@ commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2307: Cannot find module
3434
~~~~~~~~~~~~~~~~~~~~~~~~
3535
</div>;
3636
~~~~~~~~~~~~~~
37-
!!! error TS2307: Cannot find module 'react/jsx-runtime' or its corresponding type declarations.
37+
!!! error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed.
3838
}
3939
}

tests/baselines/reference/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=legacy).errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2307: Cannot find module 'react/jsx-runtime' or its corresponding type declarations.
1+
commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed.
22

33

44
==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ====
@@ -34,6 +34,6 @@ commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2307: Cannot find module
3434
~~~~~~~~~~~~~~~~~~~~~~~~
3535
</div>;
3636
~~~~~~~~~~~~~~
37-
!!! error TS2307: Cannot find module 'react/jsx-runtime' or its corresponding type declarations.
37+
!!! error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed.
3838
}
3939
}

tests/baselines/reference/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=auto).errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2307: Cannot find module 'react/jsx-dev-runtime' or its corresponding type declarations.
1+
commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2875: This JSX tag requires the module path 'react/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed.
22

33

44
==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ====
@@ -34,6 +34,6 @@ commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2307: Cannot find module
3434
~~~~~~~~~~~~~~~~~~~~~~~~
3535
</div>;
3636
~~~~~~~~~~~~~~
37-
!!! error TS2307: Cannot find module 'react/jsx-dev-runtime' or its corresponding type declarations.
37+
!!! error TS2875: This JSX tag requires the module path 'react/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed.
3838
}
3939
}

tests/baselines/reference/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2307: Cannot find module 'react/jsx-dev-runtime' or its corresponding type declarations.
1+
commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2875: This JSX tag requires the module path 'react/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed.
22

33

44
==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ====
@@ -34,6 +34,6 @@ commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2307: Cannot find module
3434
~~~~~~~~~~~~~~~~~~~~~~~~
3535
</div>;
3636
~~~~~~~~~~~~~~
37-
!!! error TS2307: Cannot find module 'react/jsx-dev-runtime' or its corresponding type declarations.
37+
!!! error TS2875: This JSX tag requires the module path 'react/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed.
3838
}
3939
}

tests/baselines/reference/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=legacy).errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2307: Cannot find module 'react/jsx-dev-runtime' or its corresponding type declarations.
1+
commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2875: This JSX tag requires the module path 'react/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed.
22

33

44
==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ====
@@ -34,6 +34,6 @@ commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2307: Cannot find module
3434
~~~~~~~~~~~~~~~~~~~~~~~~
3535
</div>;
3636
~~~~~~~~~~~~~~
37-
!!! error TS2307: Cannot find module 'react/jsx-dev-runtime' or its corresponding type declarations.
37+
!!! error TS2875: This JSX tag requires the module path 'react/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed.
3838
}
3939
}

tests/baselines/reference/inlineJsxAndJsxFragPragma.errors.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
preacty-no-fragment.tsx(5,12): error TS6133: 'Fragment' is declared but its value is never read.
2-
preacty-only-fragment-no-jsx.tsx(6,1): error TS2304: Cannot find name 'h'.
3-
snabbdomy-only-fragment-no-jsx.tsx(4,1): error TS2304: Cannot find name 'jsx'.
2+
preacty-only-fragment-no-jsx.tsx(6,1): error TS2874: This JSX tag requires 'h' to be in scope, but it could not be found.
3+
snabbdomy-only-fragment-no-jsx.tsx(4,1): error TS2874: This JSX tag requires 'jsx' to be in scope, but it could not be found.
44

55

66
==== renderer.d.ts (0 errors) ====
@@ -51,15 +51,15 @@ snabbdomy-only-fragment-no-jsx.tsx(4,1): error TS2304: Cannot find name 'jsx'.
5151
import {Fragment} from "./renderer";
5252
<></>
5353
~~
54-
!!! error TS2304: Cannot find name 'h'.
54+
!!! error TS2874: This JSX tag requires 'h' to be in scope, but it could not be found.
5555

5656
==== snabbdomy-only-fragment-no-jsx.tsx (1 errors) ====
5757
/* @jsx jsx */
5858
/* @jsxfrag null */
5959
import {} from "./renderer";
6060
<></>
6161
~~
62-
!!! error TS2304: Cannot find name 'jsx'.
62+
!!! error TS2874: This JSX tag requires 'jsx' to be in scope, but it could not be found.
6363

6464
==== preacty-no-fragment.tsx (1 errors) ====
6565
/**

tests/baselines/reference/inlineJsxFactoryWithFragmentIsError.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
index.tsx(3,1): error TS2304: Cannot find name 'React'.
1+
index.tsx(3,1): error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
22
index.tsx(3,1): error TS17017: An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments.
33
reacty.tsx(3,1): error TS17017: An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments.
44

@@ -24,6 +24,6 @@ reacty.tsx(3,1): error TS17017: An @jsxFrag pragma is required when using an @js
2424
import { dom } from "./renderer";
2525
<><h></h></>
2626
~~
27-
!!! error TS2304: Cannot find name 'React'.
27+
!!! error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
2828
~~~~~~~~~~~~
2929
!!! error TS17017: An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
test.tsx(3,17): error TS2304: Cannot find name 'factory'.
1+
test.tsx(3,17): error TS2874: This JSX tag requires 'factory' to be in scope, but it could not be found.
22

33

44
==== test.tsx (1 errors) ====
55
export class C {
66
factory() {
77
return <div></div>;
88
~~~
9-
!!! error TS2304: Cannot find name 'factory'.
9+
!!! error TS2874: This JSX tag requires 'factory' to be in scope, but it could not be found.
1010
}
1111
}
1212

tests/baselines/reference/jsxFactoryNotIdentifierOrQualifiedName.errors.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
error TS5067: Invalid value for 'jsxFactory'. 'Element.createElement=' is not a valid identifier or qualified-name.
2-
test.tsx(12,5): error TS2304: Cannot find name 'React'.
3-
test.tsx(13,5): error TS2304: Cannot find name 'React'.
2+
test.tsx(12,5): error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
3+
test.tsx(13,5): error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
44

55

66
!!! error TS5067: Invalid value for 'jsxFactory'. 'Element.createElement=' is not a valid identifier or qualified-name.
@@ -49,10 +49,10 @@ test.tsx(13,5): error TS2304: Cannot find name 'React'.
4949
return [
5050
<meta content="helloworld"></meta>,
5151
~~~~
52-
!!! error TS2304: Cannot find name 'React'.
52+
!!! error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
5353
<meta content={c.a!.b}></meta>
5454
~~~~
55-
!!! error TS2304: Cannot find name 'React'.
55+
!!! error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
5656
];
5757
}
5858
}

tests/baselines/reference/jsxFactoryNotIdentifierOrQualifiedName2.errors.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
error TS5067: Invalid value for 'jsxFactory'. 'id1 id2' is not a valid identifier or qualified-name.
2-
test.tsx(12,5): error TS2304: Cannot find name 'React'.
3-
test.tsx(13,5): error TS2304: Cannot find name 'React'.
2+
test.tsx(12,5): error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
3+
test.tsx(13,5): error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
44

55

66
!!! error TS5067: Invalid value for 'jsxFactory'. 'id1 id2' is not a valid identifier or qualified-name.
@@ -49,10 +49,10 @@ test.tsx(13,5): error TS2304: Cannot find name 'React'.
4949
return [
5050
<meta content="helloworld"></meta>,
5151
~~~~
52-
!!! error TS2304: Cannot find name 'React'.
52+
!!! error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
5353
<meta content={c.a!.b}></meta>
5454
~~~~
55-
!!! error TS2304: Cannot find name 'React'.
55+
!!! error TS2874: This JSX tag requires 'React' to be in scope, but it could not be found.
5656
];
5757
}
5858
}

0 commit comments

Comments
 (0)