diff --git a/packages/fighting-design/_utils/compatible/__test__/utils.spec.ts b/packages/fighting-design/_utils/compatible/__test__/utils.spec.ts new file mode 100644 index 0000000000..0815f68538 --- /dev/null +++ b/packages/fighting-design/_utils/compatible/__test__/utils.spec.ts @@ -0,0 +1,19 @@ +import { expect, test } from 'vitest' +import { objectEntries } from '..' + +const data = { + a: 1, + b: 2, + c: 3 +} + +test('objectEntries', () => { + /** + * @see toStrictEqual https://cn.vitest.dev/api/expect.html#tostrictequal + */ + expect(objectEntries(data)).toStrictEqual([ + ['a', 1], + ['b', 2], + ['c', 3] + ]) +}) diff --git a/packages/fighting-design/_utils/install/index.ts b/packages/fighting-design/_utils/install/index.ts index e955cb43a4..6b95484ae2 100644 --- a/packages/fighting-design/_utils/install/index.ts +++ b/packages/fighting-design/_utils/install/index.ts @@ -11,7 +11,7 @@ export type Install = T & { * @returns { Object } 组件实例 */ export const install = (main: T): Install => { - (main as Record).install = (app: App) => { + (main as Record).install = (app: App): void => { const { name } = main name && app.component(name, main) } @@ -26,7 +26,7 @@ export const install = (main: T): Install => { * @returns { Object } 组件实例 */ export const installFn = (main: T, name: string): Install => { - (main as Install).install = (app: App) => { + (main as Install).install = (app: App): void => { app.config.globalProperties[name] = main as Install } return main as Install @@ -43,7 +43,7 @@ export const installDirective = ( main: T, name: string ): Install => { - (main as Install).install = (app: App) => { + (main as Install).install = (app: App): void => { app.directive(name, main as Install) } return main as Install