Skip to content
This repository was archived by the owner on Aug 6, 2024. It is now read-only.

fix: fix _UniIndexedListOnClickEvent types #56

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/uni-indexed-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,21 @@ interface _UniIndexedListOption {
/** 索引 */
data: string[];
}
/** 数据对象 */
interface _UniIndexedItemSelected {
/** 索引标题 */
key: string;
/** 索引 */
name: string;
/** 索引序号 */
itemIndex: number;
/** 索引是否选中 */
checked: boolean;
}

interface _UniIndexedListOnClickEvent {
item: _UniIndexedListOption;
select: _UniIndexedListOption[];
item: _UniIndexedItemSelected;
select: _UniIndexedItemSelected[];
}

/** 点击触发 */
Expand Down Expand Up @@ -44,6 +55,7 @@ type _UniIndexedListInstance = InstanceType<_UniIndexedList>;

export {
_UniIndexedListOption as UniIndexedListOption,
_UniIndexedItemSelected as UniIndexedItemSelected,
_UniIndexedListOnClickEvent as UniIndexedListOnClickEvent,
_UniIndexedListOnClick as UniIndexedListOnClick,
_UniIndexedListProps as UniIndexedListProps,
Expand All @@ -55,6 +67,7 @@ declare global {
namespace UniHelper {
/** 数据对象 */
export interface UniIndexedListOption extends _UniIndexedListOption {}
export interface UniIndexedItemSelected extends _UniIndexedItemSelected {}
export type UniIndexedListOnClickEvent = _UniIndexedListOnClickEvent;
/** 点击触发 */
export interface UniIndexedListOnClick extends _UniIndexedListOnClick {}
Expand Down
4 changes: 4 additions & 0 deletions tests/uni-indexed-list.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { describe, expectTypeOf } from 'vitest';
import type {
UniIndexedListOption,
UniIndexedItemSelected,
UniIndexedListOnClickEvent,
UniIndexedListOnClick,
UniIndexedListProps,
Expand All @@ -12,6 +13,9 @@ describe('UniIndexedList', () => {
expectTypeOf<UniIndexedListOption>().toBeObject();
expectTypeOf<UniIndexedListOption>().toEqualTypeOf<UniHelper.UniIndexedListOption>();

expectTypeOf<UniIndexedItemSelected>().toBeObject();
expectTypeOf<UniIndexedItemSelected>().toEqualTypeOf<UniHelper.UniIndexedItemSelected>();

expectTypeOf<UniIndexedListOnClickEvent>().toBeObject();
expectTypeOf<UniIndexedListOnClickEvent>().toEqualTypeOf<UniHelper.UniIndexedListOnClickEvent>();

Expand Down
Loading