You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
262 B
14 lines
262 B
interface IdFunc<Type> {
|
|
id: (balue: Type) => Type
|
|
ids: () => Type[]
|
|
}
|
|
|
|
// 需要指定显示类型
|
|
let obj: IdFunc<number> = { // 指定显示的类型为 number
|
|
id(value) {
|
|
return value
|
|
},
|
|
ids() {
|
|
return [1, 3, 5]
|
|
}
|
|
}
|