摘要:
const calendarEvent = { title: 'abc submit', date: new Date(123), attendees: ["Steve", {name: 'Steve'}] } const copied = structuredClone(calendarEvent 阅读全文
摘要:
type TMethodListener<T> = (copyFn: T, ...args: any[]) => void; type TBuildInfo<TOverriden> = { mutationList: TOverriden; error?: string; }; /** * @des 阅读全文
摘要:
Say we have code below in the application: const generateRandomColor = () => { let result = ''; for (let index = 0; index < 6; index++) { const [eleme 阅读全文
摘要:
import express, { RequestHandler } from 'express'; import { it } from 'vitest'; import { z, ZodError } from 'zod'; import { Equal, Expect } from '../h 阅读全文
摘要:
import { expect, it } from 'vitest'; import { Equal, Expect } from '../helpers/type-utils'; export function compose<T1, T2>(func: (t1: T1) => T2): (t1 阅读全文
摘要:
const pick = <TObj, TKeys extends (keyof TObj)[]>(obj: TObj, picked: TKeys) => { return picked.reduce((acc, key) => { acc[key] = obj[key]; return acc; 阅读全文
摘要:
Problem for partial inference: export const makeSelectors = < TSource, TSelectors extends Record<string, (source: TSource) => any> = {}, >( selectors: 阅读全文
摘要:
For the following code: import { CSSProperties } from 'react'; const useStyled = <TTheme = {}>(func: (theme: TTheme) => CSSProperties) => { return {} 阅读全文
摘要:
const returnsValueOnly = <T>(t: T) => { return t; } const result = returnsValueOnly("a"); // const returnsValueOnly: <"a">(t: "a") => "a" const return 阅读全文
摘要:
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 阅读全文