Skip to content

Commit

Permalink
doc: update typescript.md (#440)
Browse files Browse the repository at this point in the history
修正 范型推导出列表字面量内示例代码错误
  • Loading branch information
wsypower committed Sep 23, 2023
1 parent c9dcfd2 commit c70a95e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -1557,8 +1557,8 @@ const a = <T extends string>(t: T) => t;
const b = <T extends number>(t: T) => t;
const c = <T extends boolean>(t: T) => t;
const d = a("a"); // const d: 'a'
const e = a(1); // const d: 1
const f = a(true); // const d: true
const e = b(1); // const d: 1
const f = c(true); // const d: true

// 这里t的类型用了一个展开运算
const g =
Expand Down

0 comments on commit c70a95e

Please sign in to comment.