TypeScript: Unable to get property 'compilerOptions' of undefined or null reference - with valid tsconfig.json after 1.8 upgrade rolled back

I’ve been experimenting with 1.8 upgrade. I’ve put this on a branch for our repository and checked out master. Unfortunately, the master branch no longer builds.

1>VSTSC : tsc.js(31087, 13) JavaScript runtime error : Unable to get property ‘compilerOptions’ of undefined or null reference

I’ve checked this error and it seems to be a bug in TS 1.7 when tsconfig.json is invalid JSON. Unfortunately, my tsconfig.json is very much valid JSON. I checked an online JSON validator, which gives it the green light, as does VS’s intellisense and also the fact that the master branch built just fine before trying 1.8.

Here’s the entirety of our tsconfig.json:


{
  "compilerOptions": {
    "sourceMap": true,
    "outDir": "bin-js",
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "experimentalDecorators": true
  },
  "files": [
    "../Dependencies/require.d.ts",
    "../Dependencies/d3.d.ts",
    "../Dependencies/d3.element.d.ts",
    "../Dependencies/d3.event.d.ts",
    "../Dependencies/history.d.ts",
    "../Dependencies/jquery.d.ts",
    "../Dependencies/jquery.promise.d.ts",
    "../Dependencies/jquery.when.d.ts",
    "../Dependencies/jquery.cookie.d.ts",
    "../Dependencies/jquery.autosize.d.ts",
    "../Dependencies/moment.d.ts",
    "../Dependencies/moment-fixes.d.ts",
    "../Dependencies/rangy-core.d.ts",
    "../Dependencies/route-recognizer.d.ts",
    "../Dependencies/underscore.d.ts",
    "../Dependencies/jasmine.d.ts",
    "../Dependencies/jasmineAddons.d.ts",
    "../Framework/InterfaceExtensions.ts"
  ]

}

If I delete the files, the build passes, so they’re clearly involved, but not only are they clearly valid JSON, but TS 1.7 accepted them quite happily prior to me trying out the 1.8 update.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Just a note, the build will always use TypeScriptToolsVersion value if specified. if you do not care to keep the compiler “frozen” at a specific version, you can remove the value all together, and that means it will always be using the latest installed.