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.

13 lines
262 B

2 years ago
  1. interface IdFunc<Type> {
  2. id: (balue: Type) => Type
  3. ids: () => Type[]
  4. }
  5. // 需要指定显示类型
  6. let obj: IdFunc<number> = { // 指定显示的类型为 number
  7. id(value) {
  8. return value
  9. },
  10. ids() {
  11. return [1, 3, 5]
  12. }
  13. }