From 14b7035395312560c4ebcaf8a44bb47a9a12ca21 Mon Sep 17 00:00:00 2001 From: lzxb <1340641314@qq.com> Date: Sun, 24 Dec 2023 11:31:26 +0800 Subject: [PATCH] release: vue-class-setup@1.4.2 --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/context.ts | 3 +-- src/define.ts | 8 ++++---- src/setup.ts | 8 ++++---- tests/boolean-props.spec.ts | 4 ++++ 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b326f5..20ce987 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.4.2 + +- fix: Type failure + ## 1.4.1 - fix: Type failure diff --git a/package.json b/package.json index bb9f26d..fcae598 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-class-setup", - "version": "1.4.1", + "version": "1.4.2", "main": "dist/index.cjs.js", "module": "dist/index.es.js", "types": "dist/index.d.ts", diff --git a/src/context.ts b/src/context.ts index ab903bc..0cef07b 100644 --- a/src/context.ts +++ b/src/context.ts @@ -160,8 +160,7 @@ export class Context { }; return options as { - setup: () => Omit, `$${any}`>; - data: () => Omit, `$${any}`>; + data: () => Omit, `$${string}`>; created(): void; }; } diff --git a/src/define.ts b/src/define.ts index 68a82b5..f3afdaf 100644 --- a/src/define.ts +++ b/src/define.ts @@ -16,10 +16,10 @@ type DefineInstanceType< > = Readonly & DefineInstance; export interface DefineConstructor { - inject: typeof Context['inject']; - use: typeof Context['use']; - setup: typeof Context['setup']; - setupOptions: typeof Context['setupOptions']; + inject: (typeof Context)['inject']; + use: (typeof Context)['use']; + setup: (typeof Context)['setup']; + setupOptions: (typeof Context)['setupOptions']; setupDefine: boolean; setupPropertyDescriptor: Map; new ( diff --git a/src/setup.ts b/src/setup.ts index 890f9af..a91bdd1 100644 --- a/src/setup.ts +++ b/src/setup.ts @@ -14,10 +14,10 @@ import { setupReference } from './setup-reference'; import { getPropertyDescriptors } from './property-descriptors'; export type TargetConstructor = { - use: typeof Context['use']; - inject: typeof Context['inject']; - setup: typeof Context['setup']; - setupOptions: typeof Context['setupOptions']; + use: (typeof Context)['use']; + inject: (typeof Context)['inject']; + setup: (typeof Context)['setup']; + setupOptions: (typeof Context)['setupOptions']; setupPropertyDescriptor: Map; new (...args: any[]): any; }; diff --git a/tests/boolean-props.spec.ts b/tests/boolean-props.spec.ts index 5bc9664..6318fb0 100644 --- a/tests/boolean-props.spec.ts +++ b/tests/boolean-props.spec.ts @@ -25,8 +25,11 @@ test('Base', async () => { wrapper.setProps({ boolean1: false, boolean3: true, + // @ts-ignore boolean5: '', + // @ts-ignore boolean6: '', + // @ts-ignore showIcon: '', age1: 100, age2: 10, @@ -47,6 +50,7 @@ test('Base', async () => { wrapper.setProps({ boolean1: true, boolean4: false, + // @ts-ignore age1: null, }); await wrapper.vm.$nextTick();