From 99ae8a2d76bc3d8e1cda6d076ac323b09850041f Mon Sep 17 00:00:00 2001 From: Alex Hamilton Date: Thu, 14 May 2020 18:15:39 +1200 Subject: [PATCH] ts: enable strict null checks --- src/index.ts | 4 ++-- src/service-module/make-base-model.ts | 2 +- tsconfig.json | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 54b2370c..eed5a476 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,7 +23,7 @@ import { initAuth, hydrateApi } from './utils' import { FeathersVuex } from './vue-plugin/vue-plugin' const events = ['created', 'patched', 'updated', 'removed'] -const defaults: FeathersVuexOptions = { +const defaults: Required = { autoRemove: false, // Automatically remove records missing from responses (only use with feathers-rest) addOnUpsert: false, // Add new records pushed by 'updated/patched' socketio events into store, instead of discarding them enableEvents: true, // Listens to socket.io events when available @@ -64,7 +64,7 @@ export default function feathersVuex(feathers, options: FeathersVuexOptions) { addClient({ client: feathers, serverAlias: options.serverAlias }) - const BaseModel = makeBaseModel(options) + const BaseModel = makeBaseModel(options as Required) const makeServicePlugin = prepareMakeServicePlugin(options) const makeAuthPlugin = prepareMakeAuthPlugin(feathers, options) diff --git a/src/service-module/make-base-model.ts b/src/service-module/make-base-model.ts index 7a79a905..13a4dfd7 100644 --- a/src/service-module/make-base-model.ts +++ b/src/service-module/make-base-model.ts @@ -34,7 +34,7 @@ const defaultOptions = { * * @param options */ -export default function makeBaseModel(options: FeathersVuexOptions) { +export default function makeBaseModel(options: Required) { const addModel = prepareAddModel(options) const { serverAlias } = options diff --git a/tsconfig.json b/tsconfig.json index 4a1fafd7..24711378 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,8 @@ "moduleResolution": "node", "target": "es6", "sourceMap": false, - "declaration": true + "declaration": true, + "strictNullChecks": true }, "include": ["src/**/*"], "exclude": ["node_modules", "**/*.test.js"]