diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c11ce26d883..c7bd15da0c8 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3416,7 +3416,8 @@ namespace ts { findAncestor(location, isExportDeclaration)?.moduleSpecifier || (isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : undefined)?.name || (isLiteralImportTypeNode(location) ? location : undefined)?.argument.literal; - const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : undefined)!; // TODO: GH#18217 + const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat; + const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode)!; // TODO: GH#18217 const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule); const sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNext.js b/tests/baselines/reference/reactJsxReactResolvedNodeNext.js new file mode 100644 index 00000000000..600bc4b92da --- /dev/null +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNext.js @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/reactJsxReactResolvedNodeNext.tsx] //// + +//// [file.tsx] +export const a =
; +//// [package.json] +{ + "name": "@types/react", + "version": "0.0.1", + "main": "", + "types": "index.d.ts", +} +//// [index.d.ts] +declare namespace JSX { + interface IntrinsicElements { [x: string]: any; } +} +//// [jsx-runtime.d.ts] +import './'; +//// [jsx-dev-runtime.d.ts] +import './'; + + +//// [file.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +const jsx_runtime_1 = require("react/jsx-runtime"); +exports.a = (0, jsx_runtime_1.jsx)("div", {}, void 0); diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNext.symbols b/tests/baselines/reference/reactJsxReactResolvedNodeNext.symbols new file mode 100644 index 00000000000..af564f6bc38 --- /dev/null +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNext.symbols @@ -0,0 +1,20 @@ +=== tests/cases/compiler/file.tsx === +export const a =
; +>a : Symbol(a, Decl(file.tsx, 0, 12)) +>div : Symbol(JSX.IntrinsicElements, Decl(index.d.ts, 0, 23)) +>div : Symbol(JSX.IntrinsicElements, Decl(index.d.ts, 0, 23)) + +=== tests/cases/compiler/node_modules/@types/react/index.d.ts === +declare namespace JSX { +>JSX : Symbol(JSX, Decl(index.d.ts, 0, 0)) + + interface IntrinsicElements { [x: string]: any; } +>IntrinsicElements : Symbol(IntrinsicElements, Decl(index.d.ts, 0, 23)) +>x : Symbol(x, Decl(index.d.ts, 1, 35)) +} +=== tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts === +import './'; +No type information for this code.=== tests/cases/compiler/node_modules/@types/react/jsx-dev-runtime.d.ts === +import './'; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json b/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json new file mode 100644 index 00000000000..00597f669b3 --- /dev/null +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNext.trace.json @@ -0,0 +1,135 @@ +[ + "File 'tests/cases/compiler/package.json' does not exist.", + "File 'tests/cases/package.json' does not exist.", + "File 'tests/package.json' does not exist.", + "File 'package.json' does not exist.", + "File '/package.json' does not exist.", + "======== Resolving module 'react/jsx-runtime' from 'tests/cases/compiler/file.tsx'. ========", + "Module resolution kind is not specified, using 'NodeNext'.", + "File 'tests/cases/compiler/package.json' does not exist according to earlier cached lookups.", + "File 'tests/cases/package.json' does not exist according to earlier cached lookups.", + "File 'tests/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "Loading module 'react/jsx-runtime' from 'node_modules' folder, target file type 'TypeScript'.", + "Found 'package.json' at 'tests/cases/compiler/node_modules/@types/react/package.json'.", + "'package.json' does not have a 'typesVersions' field.", + "File 'tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts' exist - use it as a name resolution result.", + "Resolving real path for 'tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts', result 'tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts'.", + "======== Module name 'react/jsx-runtime' was successfully resolved to 'tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts' with Package ID '@types/react/jsx-runtime.d.ts@0.0.1'. ========", + "File 'tests/cases/compiler/node_modules/@types/react/package.json' exists according to earlier cached lookups.", + "======== Resolving module './' from 'tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts'. ========", + "Module resolution kind is not specified, using 'NodeNext'.", + "Loading module as file / folder, candidate module location 'tests/cases/compiler/node_modules/@types/react/', target file type 'TypeScript'.", + "File 'tests/cases/compiler/node_modules/@types/react/package.json' exists according to earlier cached lookups.", + "'package.json' does not have a 'typings' field.", + "'package.json' has 'types' field 'index.d.ts' that references 'tests/cases/compiler/node_modules/@types/react/index.d.ts'.", + "File 'tests/cases/compiler/node_modules/@types/react/index.d.ts' exist - use it as a name resolution result.", + "======== Module name './' was successfully resolved to 'tests/cases/compiler/node_modules/@types/react/index.d.ts' with Package ID '@types/react/index.d.ts@0.0.1'. ========", + "File 'tests/cases/compiler/node_modules/@types/react/package.json' exists according to earlier cached lookups.", + "======== Resolving module './' from 'tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts'. ========", + "Resolution for module './' was found in cache from location 'tests/cases/compiler/node_modules/@types/react'.", + "======== Module name './' was successfully resolved to 'tests/cases/compiler/node_modules/@types/react/index.d.ts' with Package ID '@types/react/index.d.ts@0.0.1'. ========", + "File 'tests/cases/compiler/node_modules/@types/react/package.json' exists according to earlier cached lookups.", + "======== Resolving module './' from 'tests/cases/compiler/node_modules/@types/react/jsx-dev-runtime.d.ts'. ========", + "Resolution for module './' was found in cache from location 'tests/cases/compiler/node_modules/@types/react'.", + "======== Module name './' was successfully resolved to 'tests/cases/compiler/node_modules/@types/react/index.d.ts' with Package ID '@types/react/index.d.ts@0.0.1'. ========", + "File 'package.json' does not exist.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups." +] \ No newline at end of file diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNext.types b/tests/baselines/reference/reactJsxReactResolvedNodeNext.types new file mode 100644 index 00000000000..882cac56efc --- /dev/null +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNext.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/file.tsx === +export const a =
; +>a : error +>
: error +>div : any +>div : any + +=== tests/cases/compiler/node_modules/@types/react/index.d.ts === +declare namespace JSX { + interface IntrinsicElements { [x: string]: any; } +>x : string +} +=== tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts === +import './'; +No type information for this code.=== tests/cases/compiler/node_modules/@types/react/jsx-dev-runtime.d.ts === +import './'; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.js b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.js new file mode 100644 index 00000000000..bb4cddaf74e --- /dev/null +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.js @@ -0,0 +1,32 @@ +//// [tests/cases/compiler/reactJsxReactResolvedNodeNextEsm.tsx] //// + +//// [package.json] +{ + "type": "module" +} +//// [file.tsx] +export const a =
; +//// [package.json] +{ + "name": "@types/react", + "version": "0.0.1", + "main": "", + "types": "index.d.ts", + "exports": { + "./*.js": "./*.js", + "./*": "./*.js" + } +} +//// [index.d.ts] +declare namespace JSX { + interface IntrinsicElements { [x: string]: any; } +} +//// [jsx-runtime.d.ts] +import './'; +//// [jsx-dev-runtime.d.ts] +import './'; + + +//// [file.js] +import { jsx as _jsx } from "react/jsx-runtime"; +export const a = _jsx("div", {}, void 0); diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.symbols b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.symbols new file mode 100644 index 00000000000..af564f6bc38 --- /dev/null +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.symbols @@ -0,0 +1,20 @@ +=== tests/cases/compiler/file.tsx === +export const a =
; +>a : Symbol(a, Decl(file.tsx, 0, 12)) +>div : Symbol(JSX.IntrinsicElements, Decl(index.d.ts, 0, 23)) +>div : Symbol(JSX.IntrinsicElements, Decl(index.d.ts, 0, 23)) + +=== tests/cases/compiler/node_modules/@types/react/index.d.ts === +declare namespace JSX { +>JSX : Symbol(JSX, Decl(index.d.ts, 0, 0)) + + interface IntrinsicElements { [x: string]: any; } +>IntrinsicElements : Symbol(IntrinsicElements, Decl(index.d.ts, 0, 23)) +>x : Symbol(x, Decl(index.d.ts, 1, 35)) +} +=== tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts === +import './'; +No type information for this code.=== tests/cases/compiler/node_modules/@types/react/jsx-dev-runtime.d.ts === +import './'; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json new file mode 100644 index 00000000000..02a5d6a4299 --- /dev/null +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.trace.json @@ -0,0 +1,129 @@ +[ + "Found 'package.json' at 'tests/cases/compiler/package.json'.", + "'package.json' does not have a 'typesVersions' field.", + "======== Resolving module 'react/jsx-runtime' from 'tests/cases/compiler/file.tsx'. ========", + "Module resolution kind is not specified, using 'NodeNext'.", + "File 'tests/cases/compiler/package.json' exists according to earlier cached lookups.", + "Loading module 'react/jsx-runtime' from 'node_modules' folder, target file type 'TypeScript'.", + "Found 'package.json' at 'tests/cases/compiler/node_modules/@types/react/package.json'.", + "'package.json' does not have a 'typesVersions' field.", + "File name 'tests/cases/compiler/node_modules/@types/react/jsx-runtime.js' has a '.js' extension - stripping it.", + "File 'tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts' exist - use it as a name resolution result.", + "Resolving real path for 'tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts', result 'tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts'.", + "======== Module name 'react/jsx-runtime' was successfully resolved to 'tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts' with Package ID '@types/react/jsx-runtime.d.ts@0.0.1'. ========", + "File 'tests/cases/compiler/node_modules/@types/react/package.json' exists according to earlier cached lookups.", + "======== Resolving module './' from 'tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts'. ========", + "Module resolution kind is not specified, using 'NodeNext'.", + "Loading module as file / folder, candidate module location 'tests/cases/compiler/node_modules/@types/react/', target file type 'TypeScript'.", + "File 'tests/cases/compiler/node_modules/@types/react/package.json' exists according to earlier cached lookups.", + "'package.json' does not have a 'typings' field.", + "'package.json' has 'types' field 'index.d.ts' that references 'tests/cases/compiler/node_modules/@types/react/index.d.ts'.", + "File 'tests/cases/compiler/node_modules/@types/react/index.d.ts' exist - use it as a name resolution result.", + "======== Module name './' was successfully resolved to 'tests/cases/compiler/node_modules/@types/react/index.d.ts' with Package ID '@types/react/index.d.ts@0.0.1'. ========", + "File 'tests/cases/compiler/node_modules/@types/react/package.json' exists according to earlier cached lookups.", + "======== Resolving module './' from 'tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts'. ========", + "Resolution for module './' was found in cache from location 'tests/cases/compiler/node_modules/@types/react'.", + "======== Module name './' was successfully resolved to 'tests/cases/compiler/node_modules/@types/react/index.d.ts' with Package ID '@types/react/index.d.ts@0.0.1'. ========", + "File 'tests/cases/compiler/node_modules/@types/react/package.json' exists according to earlier cached lookups.", + "======== Resolving module './' from 'tests/cases/compiler/node_modules/@types/react/jsx-dev-runtime.d.ts'. ========", + "Resolution for module './' was found in cache from location 'tests/cases/compiler/node_modules/@types/react'.", + "======== Module name './' was successfully resolved to 'tests/cases/compiler/node_modules/@types/react/index.d.ts' with Package ID '@types/react/index.d.ts@0.0.1'. ========", + "File 'package.json' does not exist.", + "File '/package.json' does not exist.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", + "File 'package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups." +] \ No newline at end of file diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.types b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.types new file mode 100644 index 00000000000..882cac56efc --- /dev/null +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/file.tsx === +export const a =
; +>a : error +>
: error +>div : any +>div : any + +=== tests/cases/compiler/node_modules/@types/react/index.d.ts === +declare namespace JSX { + interface IntrinsicElements { [x: string]: any; } +>x : string +} +=== tests/cases/compiler/node_modules/@types/react/jsx-runtime.d.ts === +import './'; +No type information for this code.=== tests/cases/compiler/node_modules/@types/react/jsx-dev-runtime.d.ts === +import './'; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/cases/compiler/reactJsxReactResolvedNodeNext.tsx b/tests/cases/compiler/reactJsxReactResolvedNodeNext.tsx new file mode 100644 index 00000000000..0cc64eda70a --- /dev/null +++ b/tests/cases/compiler/reactJsxReactResolvedNodeNext.tsx @@ -0,0 +1,20 @@ +// @jsx: react-jsx +// @module: nodenext +// @traceResolution: true +// @filename: file.tsx +export const a =
; +// @filename: node_modules/@types/react/package.json +{ + "name": "@types/react", + "version": "0.0.1", + "main": "", + "types": "index.d.ts", +} +// @filename: node_modules/@types/react/index.d.ts +declare namespace JSX { + interface IntrinsicElements { [x: string]: any; } +} +// @filename: node_modules/@types/react/jsx-runtime.d.ts +import './'; +// @filename: node_modules/@types/react/jsx-dev-runtime.d.ts +import './'; diff --git a/tests/cases/compiler/reactJsxReactResolvedNodeNextEsm.tsx b/tests/cases/compiler/reactJsxReactResolvedNodeNextEsm.tsx new file mode 100644 index 00000000000..6d2fc006f15 --- /dev/null +++ b/tests/cases/compiler/reactJsxReactResolvedNodeNextEsm.tsx @@ -0,0 +1,28 @@ +// @jsx: react-jsx +// @module: nodenext +// @traceResolution: true +// @filename: package.json +{ + "type": "module" +} +// @filename: file.tsx +export const a =
; +// @filename: node_modules/@types/react/package.json +{ + "name": "@types/react", + "version": "0.0.1", + "main": "", + "types": "index.d.ts", + "exports": { + "./*.js": "./*.js", + "./*": "./*.js" + } +} +// @filename: node_modules/@types/react/index.d.ts +declare namespace JSX { + interface IntrinsicElements { [x: string]: any; } +} +// @filename: node_modules/@types/react/jsx-runtime.d.ts +import './'; +// @filename: node_modules/@types/react/jsx-dev-runtime.d.ts +import './';