Skip to content

typescript crashes in watch mode when configuration changes #37269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SimonSiefke opened this issue Mar 7, 2020 · 0 comments · Fixed by #37302
Closed

typescript crashes in watch mode when configuration changes #37269

SimonSiefke opened this issue Mar 7, 2020 · 0 comments · Fixed by #37302
Assignees
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Fix Available A PR has been opened for this issue

Comments

@SimonSiefke
Copy link

TypeScript Version: 3.9.0-dev.20200306

Search Terms: crashes in watch mode, noUnusedParameters, doneWithAffectedFile

Code

// index.ts
const fn = (a: string, b: string) => b
// tsconfig.json
{
  "compilerOptions": {
    "noUnusedParameters": true
  }
}

Expected behavior:
Start tsc in watch-mode (tsc -b -w). When changing noUnusedParameters from true to false in tsconfig.json, it shouldn't crash.

Actual behavior:
When changing noUnusedParameters from true to false, it crashes and the watcher terminates.

/tmp/tsbug/node_modules/typescript/lib/tsc.js:83917
            state.seenAffectedFiles.set(affected.resolvedPath, true);
                                    ^

TypeError: Cannot read property 'set' of undefined
    at doneWithAffectedFile (/tmp/tsbug/node_modules/typescript/lib/tsc.js:83917:37)
    at toAffectedFileEmitResult (/tmp/tsbug/node_modules/typescript/lib/tsc.js:83934:9)
    at emitNextAffectedFile (/tmp/tsbug/node_modules/typescript/lib/tsc.js:84157:20)
    at Object.emit (/tmp/tsbug/node_modules/typescript/lib/tsc.js:84171:49)
    at Object.emitFilesAndReportErrors (/tmp/tsbug/node_modules/typescript/lib/tsc.js:85406:23)
    at emit (/tmp/tsbug/node_modules/typescript/lib/tsc.js:86596:33)
    at executeSteps (/tmp/tsbug/node_modules/typescript/lib/tsc.js:86706:25)
    at Object.done (/tmp/tsbug/node_modules/typescript/lib/tsc.js:86541:13)
    at Timeout.buildNextInvalidatedProject [as _onTimeout] (/tmp/tsbug/node_modules/typescript/lib/tsc.js:87240:32)

Playground Link: None
Related Issues: #30201, #28433

@DanielRosenwasser DanielRosenwasser added Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Bug A bug in TypeScript labels Mar 8, 2020
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 3.9.0 milestone Mar 8, 2020
sheetalkamat added a commit that referenced this issue Mar 9, 2020
…ding emit because they were present in the old state

This happens in build scenarios since semantic diagnostics are queried before emit and hence files are added to seenAffectedFiles pending emit
Fixes #37269
@sheetalkamat sheetalkamat added the Fix Available A PR has been opened for this issue label Mar 9, 2020
sheetalkamat added a commit that referenced this issue Mar 12, 2020
…nding emit because they were present in the old state (#37302)

* Make the systems for baselining default to pretty

* Ensure that we have seenAffectedFiles map when files are added to pending emit because they were present in the old state
This happens in build scenarios since semantic diagnostics are queried before emit and hence files are added to seenAffectedFiles pending emit
Fixes #37269
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Fix Available A PR has been opened for this issue
Projects
None yet
3 participants