목록FE/TypeScript (3)
채린씨의 티스토리
문제 Implement the built-in Readonly generic without using it. Constructs a type with all properties of T set to readonly, meaning the properties of the constructed type cannot be reassigned. For example: interface Todo { title: string description: string } const todo: MyReadonly = { title: "Hey", description: "foobar" } todo.title = "Hello" // Error: cannot reassign a readonly property todo.descr..
문제 Implement the built-in Pick generic without using it. Constructs a type by picking the set of properties K from T For example: interface Todo { title: string description: string completed: boolean } type TodoPreview = MyPick const todo: TodoPreview = { title: 'Clean room', completed: false, } (출처: https://github.com/type-challenges/type-challenges/blob/main/questions/00004-easy-pick/README.md..
문제 Hello, World! In Type Challenges, we use the type system itself to do the assertion. For this challenge, you will need to change the following code to make the tests pass (no type check errors). // expected to be string type HelloWorld = any // you should make this work type test = Expect (출처: https://github.com/type-challenges/type-challenges/blob/main/questions/00013-warm-hello-world/README..