Closed
Description
TypeScript Version: 4.1.1-rc
(also reproduces in 4.2.0-dev.20201104
)
Search Terms: JSX factory incremental
Code
index.tsx:
export default function Foo(): JSX.Element {
return <div />;
}
tsconfig.json:
{
"compilerOptions": {
"incremental": true,
"jsx": "react-jsx"
}
}
package.json:
{
"scripts": {
"test": "tsc"
},
"devDependencies": {
"typescript": "4.1.1-rc"
},
"dependencies": {
"@types/react": "^16.9.55",
"react": "^16.14.0"
}
}
Expected behavior:
Running tsc
shouldn't crash.
Actual behavior:
/Users/billy/work/ts-bug/node_modules/typescript/lib/tsc.js:8489
throw new Error("start < 0");
^
Error: start < 0
at createTextSpan (/Users/billy/work/ts-bug/node_modules/typescript/lib/tsc.js:8489:19)
at Object.createTextSpanFromBounds (/Users/billy/work/ts-bug/node_modules/typescript/lib/tsc.js:8498:16)
at getErrorSpanForNode (/Users/billy/work/ts-bug/node_modules/typescript/lib/tsc.js:10803:19)
at Object.createDiagnosticForNodeFromMessageChain (/Users/billy/work/ts-bug/node_modules/typescript/lib/tsc.js:10711:20)
at errorOrSuggestion (/Users/billy/work/ts-bug/node_modules/typescript/lib/tsc.js:36053:141)
at errorOnImplicitAnyModule (/Users/billy/work/ts-bug/node_modules/typescript/lib/tsc.js:37798:13)
at resolveExternalModule (/Users/billy/work/ts-bug/node_modules/typescript/lib/tsc.js:37757:21)
at resolveExternalModuleNameWorker (/Users/billy/work/ts-bug/node_modules/typescript/lib/tsc.js:37711:19)
at resolveExternalModuleName (/Users/billy/work/ts-bug/node_modules/typescript/lib/tsc.js:37706:20)
at getSymbolAtLocation (/Users/billy/work/ts-bug/node_modules/typescript/lib/tsc.js:64910:32)
Playground Link:
Can't make a playground because 4.1.1-rc
isn't available there yet but here's a minimal repo.
Related Issues:
Seems related to #41330 and prior PRs.