上一页 1 ··· 45 46 47 48 49 50 51 52 53 ··· 466 下一页
摘要: const calendarEvent = { title: 'abc submit', date: new Date(123), attendees: ["Steve", {name: 'Steve'}] } const copied = structuredClone(calendarEvent 阅读全文
posted @ 2023-03-16 15:18 Zhentiw 阅读(29) 评论(0) 推荐(0) 编辑
摘要: type TMethodListener<T> = (copyFn: T, ...args: any[]) => void; type TBuildInfo<TOverriden> = { mutationList: TOverriden; error?: string; }; /** * @des 阅读全文
posted @ 2023-03-11 22:50 Zhentiw 阅读(17) 评论(0) 推荐(0) 编辑
摘要: Say we have code below in the application: const generateRandomColor = () => { let result = ''; for (let index = 0; index < 6; index++) { const [eleme 阅读全文
posted @ 2023-03-06 15:30 Zhentiw 阅读(16) 评论(0) 推荐(0) 编辑
摘要: import express, { RequestHandler } from 'express'; import { it } from 'vitest'; import { z, ZodError } from 'zod'; import { Equal, Expect } from '../h 阅读全文
posted @ 2023-03-02 16:42 Zhentiw 阅读(56) 评论(0) 推荐(0) 编辑
摘要: import { expect, it } from 'vitest'; import { Equal, Expect } from '../helpers/type-utils'; export function compose<T1, T2>(func: (t1: T1) => T2): (t1 阅读全文
posted @ 2023-03-02 03:23 Zhentiw 阅读(18) 评论(0) 推荐(0) 编辑
摘要: const pick = <TObj, TKeys extends (keyof TObj)[]>(obj: TObj, picked: TKeys) => { return picked.reduce((acc, key) => { acc[key] = obj[key]; return acc; 阅读全文
posted @ 2023-03-01 22:30 Zhentiw 阅读(32) 评论(0) 推荐(0) 编辑
摘要: Problem for partial inference: export const makeSelectors = < TSource, TSelectors extends Record<string, (source: TSource) => any> = {}, >( selectors: 阅读全文
posted @ 2023-02-27 14:58 Zhentiw 阅读(23) 评论(0) 推荐(0) 编辑
摘要: For the following code: import { CSSProperties } from 'react'; const useStyled = <TTheme = {}>(func: (theme: TTheme) => CSSProperties) => { return {} 阅读全文
posted @ 2023-02-25 20:45 Zhentiw 阅读(12) 评论(0) 推荐(0) 编辑
摘要: const returnsValueOnly = <T>(t: T) => { return t; } const result = returnsValueOnly("a"); // const returnsValueOnly: <"a">(t: "a") => "a" const return 阅读全文
posted @ 2023-02-25 15:53 Zhentiw 阅读(10) 评论(0) 推荐(0) 编辑
摘要: For example we want to have one object merge into Window with type information as well. import { Equal, Expect } from "../helpers/type-utils"; const a 阅读全文
posted @ 2023-02-24 15:22 Zhentiw 阅读(41) 评论(0) 推荐(0) 编辑
上一页 1 ··· 45 46 47 48 49 50 51 52 53 ··· 466 下一页