From fa47be84e0ac3ff75b70d91a66ad5158cbea2f47 Mon Sep 17 00:00:00 2001 From: Conicaw Date: Wed, 5 Jul 2023 18:22:31 -0500 Subject: [PATCH] build: stricter typescript Stricter typescript --- .gitignore | 3 ++- lib/http.module.ts | 4 +-- lib/http.service.ts | 3 +-- tsconfig.json | 59 ++++++++++++++++++++++++++++++++------------- 4 files changed, 47 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index d7c2d60..c26514c 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,5 @@ npm-debug.log /.nyc_output # dist -dist \ No newline at end of file +dist +tsconfig.tsbuildinfo diff --git a/lib/http.module.ts b/lib/http.module.ts index 9779959..300a9ce 100644 --- a/lib/http.module.ts +++ b/lib/http.module.ts @@ -46,7 +46,7 @@ export class HttpModule { static registerAsync(options: HttpModuleAsyncOptions): DynamicModule { return { module: HttpModule, - imports: options.imports, + ...(options.imports && {imports: options.imports}), providers: [ ...this.createAsyncProviders(options), { @@ -96,7 +96,7 @@ export class HttpModule { provide: HTTP_MODULE_OPTIONS, useFactory: async (optionsFactory: HttpModuleOptionsFactory) => optionsFactory.createHttpOptions(), - inject, + ...(inject && {inject}), }; } } diff --git a/lib/http.service.ts b/lib/http.service.ts index d76b6b2..d1b7088 100644 --- a/lib/http.service.ts +++ b/lib/http.service.ts @@ -20,8 +20,7 @@ export class HttpService { this.put = this.instance.put; this.post = this.instance.post; this.patch = this.instance.patch; - this.head = this.instance.head; - this.head = this.instance.head; + this.head = this.instance.head as typeof Axios.patch; this.delete = this.instance.delete; this.get = this.instance.get; this.request = this.instance.request; diff --git a/tsconfig.json b/tsconfig.json index 9f45945..a3103df 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,19 +1,44 @@ { - "compilerOptions": { - "module": "commonjs", - "declaration": true, - "removeComments": true, - "noLib": false, - "emitDecoratorMetadata": true, - "esModuleInterop": true, - "experimentalDecorators": true, - "target": "es6", - "sourceMap": false, - "outDir": "./dist", - "rootDir": "./lib", - "skipLibCheck": true, - }, - "include": ["lib/**/*"], - "exclude": ["node_modules"] + "include": [ + "lib/**/*" + ], + "exclude": [ + "node_modules" + ], + "$schema": "https://json.schemastore.org/tsconfig", + "display": "Node 18 + Strictest", + "compilerOptions": { + "lib": [ + "es2022" + ], + "module": "commonjs", + "target": "es2022", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "moduleResolution": "node", + "allowUnusedLabels": false, + "allowUnreachableCode": false, + "exactOptionalPropertyTypes": true, + "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noPropertyAccessFromIndexSignature": true, + "noUncheckedIndexedAccess": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "checkJs": true, + "declaration": true, + "removeComments": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "allowSyntheticDefaultImports": true, + "sourceMap": true, + "outDir": "./dist", + "rootDir": "./lib", + "incremental": true, + "strictPropertyInitialization": false, + "resolveJsonModule": true } - \ No newline at end of file +}