Просмотр исходного кода

Turn on strict mode for TypeScript

Michael Bromley 7 лет назад
Родитель
Сommit
d62b04ef03

+ 2 - 2
modules/core/api/customer/customer.controller.ts

@@ -1,6 +1,6 @@
 import { Controller, Get, Param } from '@nestjs/common';
 import { Customer } from '../../entity/customer/customer.interface';
-import { CustomerService } from './customer.service';
+import { CustomerService } from '../../service/customer.service';
 
 @Controller('customers')
 export class CustomerController {
@@ -12,7 +12,7 @@ export class CustomerController {
     }
 
     @Get(':id')
-    findOne(@Param() params): Promise<Customer> {
+    findOne(@Param() params): Promise<Customer | undefined> {
         return this.userService.findOne(params.id);
     }
 }

+ 2 - 2
modules/core/api/customer/customer.resolver.ts

@@ -2,7 +2,7 @@ import { Query, ResolveProperty, Resolver } from '@nestjs/graphql';
 import { Address } from '../../entity/address/address.interface';
 import { CustomerEntity } from '../../entity/customer/customer.entity';
 import { Customer } from '../../entity/customer/customer.interface';
-import { CustomerService } from './customer.service';
+import { CustomerService } from '../../service/customer.service';
 
 @Resolver('Customer')
 export class CustomerResolver {
@@ -14,7 +14,7 @@ export class CustomerResolver {
     }
 
     @Query('customer')
-    customer(obj, args): Promise<Customer> {
+    customer(obj, args): Promise<Customer | undefined> {
         return this.customerService.findOne(args.id);
     }
 

+ 1 - 1
modules/core/auth/jwt.strategy.ts

@@ -13,7 +13,7 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
         });
     }
 
-    async validate(payload: JwtPayload, done: (err: Error, user: any) => void) {
+    async validate(payload: JwtPayload, done: (err: Error | null, user: any) => void) {
         const user = await this.authService.validateUser(payload);
         if (!user) {
             return done(new UnauthorizedException(), false);

+ 2 - 0
tsconfig.json

@@ -11,6 +11,8 @@
     "emitDecoratorMetadata": true,
     "experimentalDecorators": true,
     "target": "es6",
+    "strict": true,
+    "strictPropertyInitialization": false,
     "sourceMap": true,
     "outDir": "./dist",
     "baseUrl": "./src"