diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-10-15 19:28:35 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-10-15 20:30:33 +0200 |
commit | 8b2f53e3ed810a0539f76feb993f0044bc8c0f38 (patch) | |
tree | f88687b498f133e8e7c0743def7ef7929f6173c6 /src/checkable.ts | |
parent | 353eeca339e060eb4a03e0b67343086854a5e5d7 (diff) | |
download | wallet-core-8b2f53e3ed810a0539f76feb993f0044bc8c0f38.tar.xz |
fix tslint warnings
Diffstat (limited to 'src/checkable.ts')
-rw-r--r-- | src/checkable.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/checkable.ts b/src/checkable.ts index 8e942d7cc..124eb6587 100644 --- a/src/checkable.ts +++ b/src/checkable.ts @@ -67,6 +67,7 @@ export namespace Checkable { props: Prop[]; } + // tslint:disable-next-line:no-shadowed-variable export const SchemaError = (function SchemaError(this: any, message: string) { const that: any = this as any; that.name = "SchemaError"; @@ -167,6 +168,7 @@ export namespace Checkable { function checkValue(target: any, prop: Prop, path: Path): any { const type = prop.type; + const typeName = type.name || "??"; if (!type) { throw Error(`assertion failed (prop is ${JSON.stringify(prop)})`); } @@ -183,7 +185,7 @@ export namespace Checkable { if (innerProp.optional) { continue; } - throw new SchemaError(`Property ${innerProp.propertyKey} missing on ${path} of ${type.name||"??"}`); + throw new SchemaError(`Property ${innerProp.propertyKey} missing on ${path} of ${typeName}`); } if (!remainingPropNames.delete(innerProp.propertyKey)) { throw new SchemaError("assertion failed"); @@ -195,7 +197,8 @@ export namespace Checkable { } if (!prop.extraAllowed && remainingPropNames.size !== 0) { - throw new SchemaError(`superfluous properties ${JSON.stringify(Array.from(remainingPropNames.values()))} of ${type.name||"??"}`); + const err = `superfluous properties ${JSON.stringify(Array.from(remainingPropNames.values()))} of ${typeName}`; + throw new SchemaError(err); } return obj; } |