From 8f3b729e4495c18f40cada7da869a5306725434a Mon Sep 17 00:00:00 2001 From: Jason Green Date: Fri, 5 Apr 2024 22:38:44 +0100 Subject: [PATCH 1/2] chore: update typescript to 5.3.3 --- package.json | 2 +- spec/types/async-validate.spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d80c51a46..04dcf1e2e 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "rollup-plugin-terser": "^7.0.2", "ts-node": "^10.9.2", "tsify": "^5.0.4", - "typescript": "^4.9.5" + "typescript": "5.3.3" }, "collective": { "type": "opencollective", diff --git a/spec/types/async-validate.spec.ts b/spec/types/async-validate.spec.ts index 8e3f0588c..508b237e5 100644 --- a/spec/types/async-validate.spec.ts +++ b/spec/types/async-validate.spec.ts @@ -110,7 +110,7 @@ describe("$async validation and type guards", () => { let result: boolean | Promise if ((result = validate(data))) { if (typeof result == "boolean") { - data.foo.should.equal(1) + ;(data as any).foo.should.equal(1) } else { await result.then((_data) => _data.foo.should.equal(1)) } From 12bfffac9a39265108b893f4f9c71990f4dc3668 Mon Sep 17 00:00:00 2001 From: Jason Green Date: Wed, 24 Apr 2024 21:13:14 +0100 Subject: [PATCH 2/2] test: result should always be a Promise --- spec/types/async-validate.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/types/async-validate.spec.ts b/spec/types/async-validate.spec.ts index 508b237e5..83a61417a 100644 --- a/spec/types/async-validate.spec.ts +++ b/spec/types/async-validate.spec.ts @@ -109,10 +109,10 @@ describe("$async validation and type guards", () => { const data: unknown = {foo: 1} let result: boolean | Promise if ((result = validate(data))) { - if (typeof result == "boolean") { - ;(data as any).foo.should.equal(1) - } else { + if (result instanceof Promise) { await result.then((_data) => _data.foo.should.equal(1)) + } else { + should.fail() } } else { should.fail()