From 144cfc49c9631096145cb4597b0c6c364895a077 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 28 Nov 2020 13:19:35 +0700 Subject: [PATCH] Upgrade dependencies --- package.json | 23 ++++++++++------------- source/predicates/predicate.ts | 6 +++--- source/utils/infer-label.ts | 3 +++ source/utils/match-shape.ts | 2 +- test/weak-map.ts | 2 +- test/weak-set.ts | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index fac61b5c..c55e1749 100644 --- a/package.json +++ b/package.json @@ -48,34 +48,31 @@ "object" ], "dependencies": { - "type-fest": "^0.18.0" + "type-fest": "^0.20.2" }, "devDependencies": { "@sindresorhus/is": "^4.0.0", - "@sindresorhus/tsconfig": "^0.7.0", + "@sindresorhus/tsconfig": "^0.8.0", "@types/lodash.isequal": "^4.5.5", - "@types/node": "^14.14.6", + "@types/node": "^14.14.10", "@types/vali-date": "^1.0.0", - "@typescript-eslint/eslint-plugin": "^4.6.0", - "@typescript-eslint/parser": "^4.6.0", - "add-asset-webpack-plugin": "^1.0.0", + "add-asset-webpack-plugin": "^2.0.0", "add-module-exports-webpack-plugin": "^2.0.0", "ava": "^2.0.0", "awesome-typescript-loader": "^5.2.1", "callsites": "^3.1.0", - "codecov": "^3.8.0", + "codecov": "^3.8.1", "del-cli": "^3.0.1", - "dot-prop": "^6.0.0", - "eslint-config-xo-typescript": "^0.35.0", + "dot-prop": "^6.0.1", "license-webpack-plugin": "^2.3.1", "lodash.isequal": "^4.5.0", "nyc": "^15.1.0", "typedoc": "^0.19.2", - "typescript": "~4.0.5", + "typescript": "~4.1.2", "vali-date": "^1.0.0", - "webpack": "^5.3.1", - "webpack-cli": "^4.1.0", - "xo": "^0.34.1" + "webpack": "^5.8.0", + "webpack-cli": "^4.2.0", + "xo": "^0.35.0" }, "browser": { "./dist/source/utils/infer-label.js": "./dist/source/utils/infer-label.browser.js" diff --git a/source/predicates/predicate.ts b/source/predicates/predicate.ts index 01f5e9db..95c8f71a 100644 --- a/source/predicates/predicate.ts +++ b/source/predicates/predicate.ts @@ -78,7 +78,7 @@ export class Predicate implements BasePredicate { ...this.options }; - const x = this.type[0].toLowerCase() + this.type.slice(1); + const typeString = this.type.charAt(0).toLowerCase() + this.type.slice(1); this.addValidator({ message: (value, label) => { @@ -88,7 +88,7 @@ export class Predicate implements BasePredicate { // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing return `Expected ${label_ || 'argument'} to be of type \`${this.type}\` but received type \`${is(value)}\``; }, - validator: value => (is as any)[x](value) + validator: value => (is as any)[typeString](value) }); } @@ -195,7 +195,7 @@ export class Predicate implements BasePredicate { message(newMessage: string | ValidatorMessageBuilder) { const {validators} = this.context; - validators[validators.length - 1].message = (value, label) => { + validators[validators.length - 1]!.message = (value, label) => { if (typeof newMessage === 'function') { return newMessage(value, label); } diff --git a/source/utils/infer-label.ts b/source/utils/infer-label.ts index d68b09ac..9750199c 100644 --- a/source/utils/infer-label.ts +++ b/source/utils/infer-label.ts @@ -21,6 +21,9 @@ export const inferLabel = (callsites: readonly CallSite[]) => { // Grab the stackframe with the `ow` function call const functionCallStackFrame = callsites[1]; + if (!functionCallStackFrame) { + return; + } const fileName = functionCallStackFrame.getFileName(); const lineNumber = functionCallStackFrame.getLineNumber(); diff --git a/source/utils/match-shape.ts b/source/utils/match-shape.ts index a9ffe9ec..2a64912c 100644 --- a/source/utils/match-shape.ts +++ b/source/utils/match-shape.ts @@ -73,7 +73,7 @@ export function exact(object: Record, shape: Shape, parent?: string } if (objectKeys.size > 0) { - const firstKey = [...objectKeys.keys()][0]; + const firstKey = [...objectKeys.keys()][0]!; const label = parent ? `${parent}.${firstKey}` : firstKey; return `Did not expect property \`${label}\` to exist, got \`${object[firstKey]}\``; } diff --git a/test/weak-map.ts b/test/weak-map.ts index a9b286e5..11594db8 100644 --- a/test/weak-map.ts +++ b/test/weak-map.ts @@ -41,7 +41,7 @@ test('weakMap.hasKeys', t => { }, 'Expected WeakMap to have keys `[{"rainbow":true}]`'); t.throws(() => { - ow(new WeakMap([[keys[0], 1], [keys[2], 3]]), ow.weakMap.hasKeys(...keys)); + ow(new WeakMap([[keys[0]!, 1], [keys[2]!, 3]]), ow.weakMap.hasKeys(...keys)); }, 'Expected WeakMap to have keys `[{"x":2},{"x":4},{"x":5},{"x":6},{"x":7}]`'); }); diff --git a/test/weak-set.ts b/test/weak-set.ts index b324db5a..002ad25d 100644 --- a/test/weak-set.ts +++ b/test/weak-set.ts @@ -51,7 +51,7 @@ test('weakSet.has', t => { }, 'Expected WeakSet to have items `[{"rainbow":"🌈"}]`'); t.throws(() => { - ow(new WeakSet([keys[1], keys[3]]), ow.weakSet.has(...keys)); + ow(new WeakSet([keys[1]!, keys[3]!]), ow.weakSet.has(...keys)); }, 'Expected WeakSet to have items `[{"x":1},{"x":3},{"x":5},{"x":6},{"x":7}]`'); });