Repository navigation
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
π Search Terms
crash createTextSpan
π Version & Regression Information
- This is a crash
β― Playground Link
No response
π» Code
https://github.com/yume-chan/ts-crash
This is a minimal repro with only 15 lines across 3 files.
π Actual behavior
pnpm i
npx tscOutput:
# npx tsc
/root/ts-crash/node_modules/.pnpm/typescript@5.5.0-dev.20240520/node_modules/typescript/lib/tsc.js:11034
throw new Error("start < 0");
^
Error: start < 0
at createTextSpan (/root/ts-crash/node_modules/.pnpm/typescript@5.5.0-dev.20240520/node_modules/typescript/lib/tsc.js:11034:11)
at createTextSpanFromBounds (/root/ts-crash/node_modules/.pnpm/typescript@5.5.0-dev.20240520/node_modules/typescript/lib/tsc.js:11042:10)
at getErrorSpanForNode (/root/ts-crash/node_modules/.pnpm/typescript@5.5.0-dev.20240520/node_modules/typescript/lib/tsc.js:13589:10)
at createDiagnosticForNodeFromMessageChain (/root/ts-crash/node_modules/.pnpm/typescript@5.5.0-dev.20240520/node_modules/typescript/lib/tsc.js:13419:16)
at resolveExternalModule (/root/ts-crash/node_modules/.pnpm/typescript@5.5.0-dev.20240520/node_modules/typescript/lib/tsc.js:48013:31)
at resolveExternalModuleNameWorker (/root/ts-crash/node_modules/.pnpm/typescript@5.5.0-dev.20240520/node_modules/typescript/lib/tsc.js:47907:61)
at resolveExternalModuleName (/root/ts-crash/node_modules/.pnpm/typescript@5.5.0-dev.20240520/node_modules/typescript/lib/tsc.js:47904:12)
at getSymbolAtLocation (/root/ts-crash/node_modules/.pnpm/typescript@5.5.0-dev.20240520/node_modules/typescript/lib/tsc.js:84201:18)
at Object.getSymbolAtLocation (/root/ts-crash/node_modules/.pnpm/typescript@5.5.0-dev.20240520/node_modules/typescript/lib/tsc.js:45191:21)
at getReferencedFilesFromImportLiteral (/root/ts-crash/node_modules/.pnpm/typescript@5.5.0-dev.20240520/node_modules/typescript/lib/tsc.js:121837:28)
Node.js v21.6.2
π Expected behavior
No crash.
Additional information about the issue
Reproducible in both 5.4.5 and 5.5.0-dev.20240520
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Activity
Andarist commentedon May 21, 2024
You have a synthetic import to
solid-js/jsx-runtimehere. It's an ESM file but you are importing it from a CJS one. TS crashes when trying to raise 1479 diagnostic:The reason it crashes here is that you have
composite: true. This option enables incremental compilation and that eagerly callsresolveExternalModuleNamefromgetReferencedFiles.Offroaders123 commentedon Aug 27, 2024
Noticed this while trying to run
tsc -won a project with JSR as the package manager. It also seemed to be crashing with the JSX import source,"jsxImportSource": "@hono/hono/jsx".Type Checking, Initial Node Test
iisaduan commentedon Aug 27, 2024
Brandon Bennett (@Offroaders123) The fix is included in 5.6.0 and above (or any nightly after Jun 24)