user2478240
user2478240

Reputation: 369

TSConfig Unknown compiler option 'lib'

I am taking over an old angular 1 project with typescript 1.8.10.

However I can't compile and it keeps throwing me this :

Unknown compiler option 'lib'

if i comment out the "lib" line, then I will face a huge load of other errors such as

 Property 'X' does not exist on type 'Y'

this is a fairly huge old project and I only want it to run for 2 weeks, so re-coding it is not an option for me due to timeline.

I have tried changing many versions of typescript, but the same issue shows for me, I also tried to build using --noImplicitUseStrict but it doesn't help.

Here is my tsconfig.json and my package.json

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
      "module": "commonjs",
      "target": "es5",
      "noImplicitUseStrict" : true,
      "lib": ["es2015", "dom"]
 },
  "exclude": [
      "bower_components",
      "node_modules",
      "typings"
  ]
}

{
  "name": "xxx",
  "version": "0.0.0",
  "dependencies": {
    "@types/jquery": "^3.3.29",
    "grunt": "^1.0.4",
    "grunt-cli": "^1.3.2",
    "gulp-awspublish": "^3.3.0",
    "gulp-s3-deploy": "^1.0.1",
    "moment": "^2.24.0",
    "npm": "^6.9.0",
    "socket.io-client": "^1.7.2"
  },
  "scripts": {
    "test": "gulp test"
  },
  "devDependencies": {
    "@angular/cli": "^7.3.3",
    "browser-sync": "^2.26.5",
    "browser-sync-spa": "~1.0.3",
    "chalk": "~1.1.1",
    "del": "~2.0.2",
    "eslint-plugin-angular": "~0.12.0",
    "estraverse": "~4.1.0",
    "gulp": "^3.9.1",
    "gulp-angular-templatecache": "~1.8.0",
    "gulp-autoprefixer": "~3.0.2",
    "gulp-awspublish": "^3.3.0",
    "gulp-cssnano": "~2.1.1",
    "gulp-eslint": "~1.0.0",
    "gulp-filter": "~3.0.1",
    "gulp-flatten": "~0.2.0",
    "gulp-htmlmin": "~1.3.0",
    "gulp-inject": "~3.0.0",
    "gulp-load-plugins": "~0.10.0",
    "gulp-protractor": "~2.1.0",
    "gulp-rename": "~1.2.2",
    "gulp-replace": "~0.5.4",
    "gulp-rev": "~6.0.1",
    "gulp-rev-replace": "~0.4.2",
    "gulp-s3-deploy": "^1.0.1",
    "gulp-sass": "~2.0.4",
    "gulp-size": "~2.0.0",
    "gulp-sourcemaps": "~1.6.0",
    "gulp-uglify": "~1.4.1",
    "gulp-useref": "^3.1.6",
    "gulp-util": "~3.0.6",
    "http-proxy-middleware": "^0.19.1",
    "karma": "~0.13.10",
    "karma-coverage": "~0.5.2",
    "karma-jasmine": "~0.3.6",
    "karma-ng-html2js-preprocessor": "~0.2.0",
    "karma-phantomjs-launcher": "~0.2.1",
    "karma-phantomjs-shim": "~1.2.0",
    "lodash": "~3.10.1",
    "main-bower-files": "^2.13.1",
    "ng-annotate-loader": "0.0.10",
    "phantomjs": "~1.9.18",
    "ts-loader": "~0.8.0",
    "tslint-loader": "~1.0.2",
    "typescript": "^1.8.10",
    "typings": "~0.7.9",
    "uglify-save-license": "~0.4.1",
    "webpack-stream": "~2.1.1",
    "wiredep": "~2.2.2"
  },
  "engines": {
    "node": ">=0.10.0"
  }
}

Please give me some advice on this. I am building it using Gulp.

Upvotes: 2

Views: 3101

Answers (2)

Ronan Ca
Ronan Ca

Reputation: 460

In my case, I just forgot to npm install before npm build. It might help someone.

Upvotes: 1

TimW
TimW

Reputation: 156

lib is a TypeScript 2 feature, and as you mentioned you are using 1.8. You could remove that lib from the tsconfig.json or Try upgrading to a newer typescript version.

In my package.json, I'm using the following dev dependencies:

"ts-loader": "^5.4.4",
"typescript": "^3.4.5",

However, you may find some of your typescript breaks if you upgrade.

Upvotes: 0

Related Questions