react-component / react-component/table
TS: 我发现 dataIndex 可以推导出来,但是 目前的ts声明里面没有,请问可以加一下吗?
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 618
- Avg merge
- 10h 19m
- Merged PRs (30d)
- 2
Description
Before:
export interface ColumnType<RecordType> extends ColumnSharedType<RecordType> {
colSpan?: number;
dataIndex?: DataIndex;
render?: (value: any, record: RecordType, index: number) => React.ReactNode | RenderedCell<RecordType>;
shouldCellUpdate?: (record: RecordType, prevRecord: RecordType) => boolean;
rowSpan?: number;
width?: number | string;
onCell?: GetComponentProps<RecordType>;
/** @deprecated Please use `onCell` instead */
onCellClick?: (record: RecordType, e: React.MouseEvent<HTMLElement>) => void;
}
The suitable I think:
export interface ColumnType<RecordType> extends ColumnSharedType<RecordType> {
colSpan?: number;
dataIndex?: keyof RecordType;
render?: (value: any, record: RecordType, index: number) => React.ReactNode | RenderedCell<RecordType>;
shouldCellUpdate?: (record: RecordType, prevRecord: RecordType) => boolean;
rowSpan?: number;
width?: number | string;
onCell?: GetComponentProps<RecordType>;
/** @deprecated Please use `onCell` instead */
onCellClick?: (record: RecordType, e: React.MouseEvent<HTMLElement>) => void;
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the repository for the ColumnType and DataIndex declarations, then inspect nearby TypeScript type tests or usage examples. Check whether dataIndex can be constrained to RecordType keys without breaking existing table columns; done means the declaration accepts valid keys and the relevant type checks pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100