diff --git a/spec/helpers/matchers.ts b/spec/helpers/matchers.ts index 883078a..a3e64a4 100644 --- a/spec/helpers/matchers.ts +++ b/spec/helpers/matchers.ts @@ -96,7 +96,7 @@ beforeEach(() => { const secondAsInt8Array: Int8Array | undefined = tryAsInt8Array(second); if (firstAsInt8Array === undefined || secondAsInt8Array === undefined) { - return; + return undefined; } if (firstAsInt8Array.length !== secondAsInt8Array.length) { @@ -112,6 +112,7 @@ function tryAsInt8Array(obj: any): Int8Array | undefined { } else if (ArrayBuffer.isView(obj)) { return new Int8Array(obj.buffer); } + return undefined; } // eslint-disable-next-line @typescript-eslint/no-namespace diff --git a/src/deserializer.ts b/src/deserializer.ts index 68d6000..0aec647 100644 --- a/src/deserializer.ts +++ b/src/deserializer.ts @@ -20,6 +20,7 @@ export function defaultTypeResolver( if (sourceObject.__type != null) { return knownTypes.get(sourceObject.__type); } + return undefined; } export type DeserializerFn = ( diff --git a/src/metadata.ts b/src/metadata.ts index e97996b..fc5a545 100644 --- a/src/metadata.ts +++ b/src/metadata.ts @@ -112,7 +112,7 @@ export class JsonObjectMetadata { static getFromConstructor(ctor: Serializable): JsonObjectMetadata | undefined { const prototype = ctor.prototype; if (prototype == null) { - return; + return undefined; } let metadata: JsonObjectMetadata | undefined; @@ -133,6 +133,8 @@ export class JsonObjectMetadata { // we do not store the metadata here to not modify builtin prototype return primitiveMeta; } + + return undefined; } static ensurePresentInPrototype(prototype: IndexedObject): JsonObjectMetadata { diff --git a/src/parser.ts b/src/parser.ts index 6431f79..3873dd8 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -467,6 +467,7 @@ export class TypedJSON { } catch (e) { this.errorHandler(e); } + return undefined; } toPlainArray(object: Array, dimensions?: 1): Array; @@ -489,6 +490,7 @@ export class TypedJSON { } catch (e) { this.errorHandler(e); } + return undefined; } toPlainSet(object: Set): Array | undefined { @@ -497,6 +499,7 @@ export class TypedJSON { } catch (e) { this.errorHandler(e); } + return undefined; } toPlainMap( @@ -511,6 +514,7 @@ export class TypedJSON { } catch (e) { this.errorHandler(e); } + return undefined; } /** diff --git a/tsconfig/tsconfig.app-strict.json b/tsconfig/tsconfig.app-strict.json index dcf945b..44dc5b9 100644 --- a/tsconfig/tsconfig.app-strict.json +++ b/tsconfig/tsconfig.app-strict.json @@ -1,6 +1,13 @@ { "extends": "./tsconfig.app.json", "compilerOptions": { - "noUnusedLocals": true + "noUnusedLocals": true, + "strict": true, + "allowJs": false, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "noImplicitReturns": true, + "preserveConstEnums": true } }