Skip to content

getCompilerOptionValue can be called with options = undefined after tsconfig#module change #50902

@HolgerJeromin

Description

@HolgerJeromin

Bug Report

🔎 Search Terms

modules esmodules

🕗 Version & Regression Information

v4.8.2

  • This is a crash

I am converting some old code from module=none to module=es2015.
After changing the code and tsconfig I get

in folder: C:\tfs\TwinCAT-HMI\TcHmiFramework ...C:\tfs\TwinCAT-HMI\TcHmiFramework\node_modules\typescript\lib\tsc.js:16219 return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name]; ^ TypeError: Cannot read properties of undefined (reading 'outFile') at getCompilerOptionValue (C:\tfs\TwinCAT-HMI\TcHmiFramework\node_modules\typescript\lib\tsc.js:16219:88) at C:\tfs\TwinCAT-HMI\TcHmiFramework\node_modules\typescript\lib\tsc.js:10977:33 at Array.some (<anonymous>) at optionsHaveChanges (C:\tfs\TwinCAT-HMI\TcHmiFramework\node_modules\typescript\lib\tsc.js:10976:64) at Object.compilerOptionsAffectDeclarationPath (C:\tfs\TwinCAT-HMI\TcHmiFramework\node_modules\typescript\lib\tsc.js:16214:16) at createBuilderProgramState (C:\tfs\TwinCAT-HMI\TcHmiFramework\node_modules\typescript\lib\tsc.js:100565:17) at Object.createBuilderProgram (C:\tfs\TwinCAT-HMI\TcHmiFramework\node_modules\typescript\lib\tsc.js:101181:21) at createEmitAndSemanticDiagnosticsBuilderProgram (C:\tfs\TwinCAT-HMI\TcHmiFramework\node_modules\typescript\lib\tsc.js:101554:19) at Object.host.createProgram (C:\tfs\TwinCAT-HMI\TcHmiFramework\node_modules\typescript\lib\tsc.js:106634:20) at createProgram (C:\tfs\TwinCAT-HMI\TcHmiFramework\node_modules\typescript\lib\tsc.js:104850:28) 

return option.strictFlag ? getStrictOptionValue(options, option.name as StrictOptionName) : options[option.name];

Added some debug output in this js file:

option: { name: 'outFile', type: 'string', affectsEmit: true, affectsMultiFileEmitBuildInfo: true, affectsDeclarationPath: true, affectsBundleEmitBuildInfo: true, isFilePath: true, paramType: { code: 6035, category: 3, key: 'FILE_6035', message: 'FILE', reportsUnnecessary: undefined, elidedInCompatabilityPyramid: undefined, reportsDeprecated: undefined }, showInSimplifiedHelpView: true, category: { code: 6246, category: 3, key: 'Emit_6246', message: 'Emit', reportsUnnecessary: undefined, elidedInCompatabilityPyramid: undefined, reportsDeprecated: undefined }, description: { code: 6679, category: 3, key: 'Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designa_6679', message: "Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output.", reportsUnnecessary: undefined, elidedInCompatabilityPyramid: undefined, reportsDeprecated: undefined }, transpileOptionValue: undefined } options: undefined 

Changed the line to
return option.strictFlag ? getStrictOptionValue(options, option.name) : options?.[option.name];
and got a working compile.
After that the unchanged typescript compiler works again. So I suspect a problem with an old tsconfig.tsbuildinfo.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions