3

How can I configure the vue-cli tool to not run type checks on a specific folder?

  • I spun up a new app with https://cli.vuejs.org
  • I generated a jQuery/TypeScript API directory via codegen: src/api/
  • I ignored in the tslint file the "src/api/**/*.ts",

Try to build, but the cli tool is also checking for type errors.

The output of serve is:

vue-cli-service serve

 INFO  Starting development server...
Starting type checking and linting service...
Using 1 worker with 2048MB memory limit
 98% after emitting CopyPlugin                                                    

 DONE  Compiled successfully in 2701ms                                                                     3:50:28 PM

Type checking and linting in progress...

  App running at:
  - Local:   http://localhost:8080/ 
  - Network: http://192.168.1.32:8080/

  Note that the development build is not optimized.
  To create a production build, run npm run build.

ERROR in /home/me/code/g2/frontend/fe_main/src/api/ms-authentication/api/AuthenticationApi.ts
25:12 Type 'null' is not assignable to type 'JQueryAjaxSettings | undefined'.
    23 |     protected basePath = 'http://localhost';
    24 |     public defaultHeaders: Array<string> = [];
  > 25 |     public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
       |            ^
    26 |     public configuration: Configuration = new Configuration();
    27 | 
    28 |     constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
ERROR in /home/me/code/g2/frontend/fe_main/src/api/ms-authentication/api/PasswordApi.ts
25:12 Type 'null' is not assignable to type 'JQueryAjaxSettings | undefined'.
    23 |     protected basePath = 'http://localhost';
    24 |     public defaultHeaders: Array<string> = [];
  > 25 |     public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
       |            ^
    26 |     public configuration: Configuration = new Configuration();
    27 | 
    28 |     constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {

But I cannot change this code without modifying the codegen templates. :/

1
  • As htn pointed out, those are build errors in TypeScript 2.0 (or later), where the strictNullChecks compiler option was introduced. If you need to include this code, you could disable strictNullChecks in tsconfig.json to workaround the build error, but you'd lose the strict check in your own code. Commented Apr 21, 2019 at 6:21

1 Answer 1

1

You should either modify the generated code or disable the strictNullChecks of typescript compiler option.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.