上一页 1 ··· 76 77 78 79 80 81 82 83 84 ··· 494 下一页
摘要: The builder pattern is a design pattern commonly used in OOP. It is used to create complex objects step by step throught a series of methods, each of 阅读全文
posted @ 2023-02-13 16:41 Zhentiw 阅读(34) 评论(0) 推荐(0)
摘要: file1: import { expect, it } from "vitest"; /** * Here, we've actually got _multiple_ problem files! * Make sure to to check problem.2.ts too. */ decl 阅读全文
posted @ 2023-02-10 21:09 Zhentiw 阅读(26) 评论(0) 推荐(0)
摘要: We have the following code: class Form<TValues> { error?: string; constructor( public values: TValues, private validate: (values: TValues) => string | 阅读全文
posted @ 2023-02-10 21:03 Zhentiw 阅读(25) 评论(0) 推荐(0)
摘要: import { it } from 'vitest'; import { Brand } from '../helpers/Brand'; type Valid<T> = Brand<T, 'Valid'>; interface PasswordValues { password: string; 阅读全文
posted @ 2023-02-10 20:44 Zhentiw 阅读(20) 评论(0) 推荐(0)
摘要: import { it } from 'vitest'; import { Equal, Expect } from '../helpers/type-utils'; export const isDivElement = (element: unknown): element is HTMLDiv 阅读全文
posted @ 2023-02-10 20:38 Zhentiw 阅读(19) 评论(0) 推荐(0)
摘要: import { expect, it } from "vitest"; import { Equal, Expect } from "../helpers/type-utils"; export const values = ["a", "b", undefined, "c", undefined 阅读全文
posted @ 2023-02-10 02:10 Zhentiw 阅读(25) 评论(0) 推荐(0)
摘要: import { Equal, Expect } from "../helpers/type-utils"; const obj = { a: 1, b: 2, c: 3, } as const; type ObjKey = keyof typeof obj; //Type '"a"' is not 阅读全文
posted @ 2023-02-08 15:57 Zhentiw 阅读(41) 评论(0) 推荐(0)
摘要: // You'll need to use function overloads to figure this out! function useData<T>(params: { fetchData: () => Promise<T>; initialData?: T }): { getData: 阅读全文
posted @ 2023-02-08 14:18 Zhentiw 阅读(28) 评论(0) 推荐(0)
摘要: Define function / variable in global scope globalThis.myFunc = () => true; // doesn't compile globalThis.myVar = 1; // doesn't compile it("Should let 阅读全文
posted @ 2023-02-06 21:04 Zhentiw 阅读(40) 评论(0) 推荐(0)
摘要: In this exercise, we're going to look at a really interesting property of branded types when they're used with index signatures. Here we have our User 阅读全文
posted @ 2023-02-06 03:38 Zhentiw 阅读(38) 评论(0) 推荐(0)
上一页 1 ··· 76 77 78 79 80 81 82 83 84 ··· 494 下一页