How to get rid of the warning .ts file is part of the TypeScript compilation but it's unused

后端 未结 16 1010
天命终不由人
天命终不由人 2020-12-30 18:20

I Just updated angular to latest 9.0.0-next.4. I am not using routing but suddenly after updating I keep seeing this warning. How Do I remove this warning

相关标签:
16条回答
  • 2020-12-30 18:54

    It turned out that you need to remove this line from "include" "src/**/*.ts" from tsconfig.app.json and only keep entry points in files (main.ts and polyfills.ts)

    0 讨论(0)
  • 2020-12-30 18:57

    I faced same issue after updating angular 9 app to angular 10. Updating angular-devkit solved it.

    0 讨论(0)
  • 2020-12-30 18:58

    Are you using @angular-builders/custom-webpack?

    I was getting bombarded with these messages in Angular 10 having never seen them before. Changing includes made no difference.

    Then I found https://github.com/angular/angular/pull/36211.

    This is essentially the same error as raised in this question but for ngtypecheck.ts files (whatever they are exactly i'm not sure!)

    WARNING in /home/circleci/ng/aio/src/main.ngtypecheck.ts is part of the TypeScript compilation but it's unused. Add only entry points to the 'files' or 'include' properties in your tsconfig.

    It looks like for me it's actually to do with @angular-builders/custom-webpack.

    https://github.com/just-jeb/angular-builders/issues/781 where an issue was only just opened. Thanks to https://stackoverflow.com/a/62573294/16940 for pointing this out.

    Updating to the v10.0.1 fixed it for me, but see the above issue for the latest.

    "@angular-builders/custom-webpack": "10.0.1"    // as of today
    
    0 讨论(0)
  • 2020-12-30 18:58

    02-08-2020

    Ionic 5+ Angular 9+ App.

    Note: see the include section.

    tsconfig.app.json

    {
      "extends": "./tsconfig.json",
      "compilerOptions": {
        "outDir": "./out-tsc/app",
        "types": []
      },
      "files": [
        "src/main.ts",
        "src/polyfills.ts"
      ],
      "include": [
        "src/**/*.d.ts"
      ],
      "exclude": [
        "src/**/*.spec.ts"
      ]
    }
    
    0 讨论(0)
  • 2020-12-30 18:58

    after try out the before solutions proposals , it worked for me

    update in your package.json

    "@angular-devkit/build-angular": "~0.1000.3" 
    

    can you see here all versions.

    https://www.npmjs.com/package/@angular-devkit/build-angular?activeTab=versions

    check which version work with you current version from angular/core

    for angular 10 work with version 0.1000.3 of @angular-devkit/build-angular

    0 讨论(0)
  • 2020-12-30 18:58

    I tried many things to solve this problem, and in the end I was able to solve it.

    my problem was updating an app that was found in angular 8.1 to angular 9.x, but the app also used Ionic

    you should only have aot: true inside angular.json

    in src / polyfills.ts to import './zone-flags.ts'; remove .ts

    https://medium.com/@grantbrits/upgrade-ionic-4-to-ionic-5-angular-76514079fb2aenter image description here

    0 讨论(0)
提交回复
热议问题