上一页 1 ··· 92 93 94 95 96 97 98 99 100 ··· 469 下一页
摘要: function flipCoin(): "heads" | "tails" { if (Math.random() > 0.5) return "heads" return "tails" } function maybeGetUserInfo(): | ["error", Error] | [" 阅读全文
posted @ 2022-07-26 14:50 Zhentiw 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 1. const values = [3, "14", [21]] for (let a in values) { // ^? } for (let b of values) { // ^? } . . . . Answer: for...in loop: The for...in statemen 阅读全文
posted @ 2022-07-26 14:24 Zhentiw 阅读(37) 评论(0) 推荐(0) 编辑
摘要: TypeScript helps us catch a particular type of problem around the use of object literals. Let’s look at the situation where the error arises: // @erro 阅读全文
posted @ 2022-07-25 16:15 Zhentiw 阅读(37) 评论(0) 推荐(0) 编辑
摘要: If<C, T, F> Implement a type that evaluates to T if the type C is true or F if C is false. // Implement this type type If<C, T, F> = C extends true ? 阅读全文
posted @ 2022-07-21 15:02 Zhentiw 阅读(27) 评论(0) 推荐(0) 编辑
摘要: Union type: means "one of" those types Intersection type: means "combination" of those types Intersection types type typeAB = typeA & typeB; interface 阅读全文
posted @ 2022-07-19 16:51 Zhentiw 阅读(33) 评论(0) 推荐(0) 编辑
摘要: Res1: https://www.typescript-training.com/course/making-typescript-stick/08-type-challenges/#returnoff Res2: https://learntypescript.dev/09/l2-conditi 阅读全文
posted @ 2022-07-19 16:24 Zhentiw 阅读(190) 评论(0) 推荐(0) 编辑
摘要: `any` type, you can assign any value for any type. For `unkown`, you can also assign any value to unkwon: But you cannot assign unkwon variable to ano 阅读全文
posted @ 2022-07-19 02:27 Zhentiw 阅读(20) 评论(0) 推荐(0) 编辑
摘要: Key Terms Availability The odds of a particular server or service being up and running at any point in time, usually measured in percentages. A server 阅读全文
posted @ 2022-07-17 20:19 Zhentiw 阅读(18) 评论(0) 推荐(0) 编辑
摘要: https://btholt.github.io/complete-intro-to-realtime/socketio https://btholt.github.io/complete-intro-to-realtime/intro-to-websockets Socket.io: FE: co 阅读全文
posted @ 2022-07-15 21:27 Zhentiw 阅读(28) 评论(0) 推荐(0) 编辑
摘要: https://btholt.github.io/complete-intro-to-realtime/intro-to-http2-push long-running HTTP call HTTP2 PUSH FE: async function getNewMsgs() { let reader 阅读全文
posted @ 2022-07-15 19:43 Zhentiw 阅读(46) 评论(0) 推荐(0) 编辑
上一页 1 ··· 92 93 94 95 96 97 98 99 100 ··· 469 下一页