摘要: Let's say we have: type Fruit = "apple" | "banana" | "orange"; We only want AppleOrBanana If we do as such: type Fruit = "apple" | "banana" | "orange" 阅读全文
posted @ 2022-12-12 15:52 Zhentiw 阅读(47) 评论(0) 推荐(0)
摘要: Let's imagine you're building a type helper to extract out the value from several different 'parsers'. const parser1 = { parse: () => 1, }; const pars 阅读全文
posted @ 2022-12-12 15:40 Zhentiw 阅读(39) 评论(0) 推荐(0)
摘要: Example 1 import { S } from "ts-toolbelt"; import { Equal, Expect } from "../helpers/type-utils"; type Names = [ "Matt Pocock", "Jimi Hendrix", "Eric 阅读全文
posted @ 2022-12-12 15:20 Zhentiw 阅读(133) 评论(0) 推荐(0)
摘要: In this exercise we have an interface MyComplexInterface which is acting as a type helper. The interface takes arguments for Event, Context, Name, and 阅读全文
posted @ 2022-12-12 15:08 Zhentiw 阅读(48) 评论(0) 推荐(0)