上一页 1 ··· 74 75 76 77 78 79 80 81 82 ··· 494 下一页
摘要: For the following code: import { CSSProperties } from 'react'; const useStyled = <TTheme = {}>(func: (theme: TTheme) => CSSProperties) => { return {} 阅读全文
posted @ 2023-02-25 20:45 Zhentiw 阅读(20) 评论(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 阅读(17) 评论(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 阅读(58) 评论(0) 推荐(0)
摘要: import { Equal, Expect } from '../helpers/type-utils'; export function makeEventHandlers< T extends { [Key in keyof T]: (key: Key) => void } >(obj: T) 阅读全文
posted @ 2023-02-24 15:02 Zhentiw 阅读(26) 评论(0) 推荐(0)
摘要: So we have the configObj look like this: export const configObj = { routes: ["/", "/about", "/contact"], fetchers: { // @ts-expect-error "/does-not-ex 阅读全文
posted @ 2023-02-24 14:58 Zhentiw 阅读(27) 评论(0) 推荐(0)
摘要: From ts-toolbelt /** * Explain to TS which function parameter has priority for generic inference * @param A to de-prioritize * @returns `A` * @example 阅读全文
posted @ 2023-02-23 16:01 Zhentiw 阅读(106) 评论(0) 推荐(0)
摘要: import { getAnimatingState } from "fake-animation-lib"; import { Equal, Expect } from "../helpers/type-utils"; const animatingState = getAnimatingStat 阅读全文
posted @ 2023-02-23 15:12 Zhentiw 阅读(230) 评论(0) 推荐(0)
摘要: import React from 'react'; declare global { namespace JSX { interface IntrinsicElements { 'custom-element': { children?: React.ReactNode; title?: stri 阅读全文
posted @ 2023-02-22 15:38 Zhentiw 阅读(57) 评论(0) 推荐(0)
摘要: import { Equal, Expect } from '../helpers/type-utils'; import { F } from 'ts-toolbelt'; interface Fruit { name: string; price: number; } export const 阅读全文
posted @ 2023-02-22 15:17 Zhentiw 阅读(22) 评论(0) 推荐(0)
摘要: In Javascript, if you are using Object to store key-valeu pairs while you will be adding and deleting keys frequently, then you should use Map instead 阅读全文
posted @ 2023-02-21 16:08 Zhentiw 阅读(25) 评论(0) 推荐(0)
上一页 1 ··· 74 75 76 77 78 79 80 81 82 ··· 494 下一页