Skip to content

Commit 2a1dc2f

Browse files
terry-shafc163
authored andcommitted
fix: Typescript type declaration of OptionProps (#432)
1 parent 09be31b commit 2a1dc2f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Option.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/* istanbul ignore file */
22
import * as React from 'react';
3-
import { OptionData } from './interface';
3+
import { OptionCoreData } from './interface';
44

5-
export interface OptionProps extends Omit<OptionData, 'label'> {
5+
export interface OptionProps extends Omit<OptionCoreData, 'label'> {
66
children: React.ReactNode;
7+
8+
/** Save for customize data */
9+
[prop: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any
710
}
811

912
export interface OptionFC extends React.FC<OptionProps> {

src/interface/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type RenderNode = React.ReactNode | ((props: any) => React.ReactNode);
88
export type Mode = 'multiple' | 'tags' | 'combobox';
99

1010
// ======================== Option ========================
11-
export interface OptionData {
11+
export interface OptionCoreData {
1212
key?: Key;
1313
disabled?: boolean;
1414
value: Key;
@@ -18,7 +18,9 @@ export interface OptionData {
1818
label?: React.ReactNode;
1919
/** @deprecated Only works when use `children` as option data */
2020
children?: React.ReactNode;
21+
}
2122

23+
export interface OptionData extends OptionCoreData {
2224
/** Save for customize data */
2325
[prop: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any
2426
}

0 commit comments

Comments
 (0)