docs: Remove predix I from interface

This commit is contained in:
Meck Zhu 2019-06-27 14:17:08 +08:00
parent 080842bbf9
commit 4463d24660
2 changed files with 16 additions and 16 deletions

View File

@ -191,28 +191,28 @@ Properties for row selection.
import { Table } from 'antd';
import { ColumnProps } from 'antd/lib/table';
interface IUser {
interface User {
key: number,
name: string;
}
const columns: ColumnProps<IUser>[] = [{
const columns: ColumnProps<User>[] = [{
key: 'name',
title: 'Name',
dataIndex: 'name',
}];
const data: IUser[] = [{
const data: User[] = [{
key: 0,
name: 'Jack',
}];
class UserTable extends Table<IUser> {}
class UserTable extends Table<User> {}
<UserTable columns={columns} dataSource={data} />
// Use JSX style API
class NameColumn extends Table.Column<IUser> {}
class NameColumn extends Table.Column<User> {}
<UserTable dataSource={data}>
<NameColumn key="name" title="Name" dataIndex="name" />
@ -220,9 +220,9 @@ class NameColumn extends Table.Column<IUser> {}
// after TypeScript 2.9 can write like this
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html#generic-type-arguments-in-jsx-elements
<Table<IUser> columns={columns} dataSource={data} />
<Table<IUser> dataSource={data}>
<Table.Column<IUser> key="name" title="Name" dataIndex="name" />
<Table<User> columns={columns} dataSource={data} />
<Table<User> dataSource={data}>
<Table.Column<User> key="name" title="Name" dataIndex="name" />
</Table>
```

View File

@ -196,27 +196,27 @@ const columns = [
import { Table } from 'antd';
import { ColumnProps } from 'antd/lib/table';
interface IUser {
interface User {
key: number;
name: string;
}
const columns: ColumnProps<IUser>[] = [{
const columns: ColumnProps<User>[] = [{
key: 'name',
title: 'Name',
dataIndex: 'name',
}];
const data: IUser[] = [{
const data: User[] = [{
key: 0,
name: 'Jack',
}];
class UserTable extends Table<IUser> {}
class UserTable extends Table<User> {}
<UserTable columns={columns} dataSource={data} />
// 使用 JSX 风格的 API
class NameColumn extends Table.Column<IUser> {}
class NameColumn extends Table.Column<User> {}
<UserTable dataSource={data}>
<NameColumn key="name" title="Name" dataIndex="name" />
@ -224,9 +224,9 @@ class NameColumn extends Table.Column<IUser> {}
// TypeScript 2.9 之后也可以这样写
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html#generic-type-arguments-in-jsx-elements
<Table<IUser> columns={columns} dataSource={data} />
<Table<IUser> dataSource={data}>
<Table.Column<IUser> key="name" title="Name" dataIndex="name" />
<Table<User> columns={columns} dataSource={data} />
<Table<User> dataSource={data}>
<Table.Column<User> key="name" title="Name" dataIndex="name" />
</Table>
```