muben's recent timeline updates
muben

muben

V2EX member #636001, joined on 2023-06-27 10:44:11 +08:00
Today's activity rank 26595
muben's recent replies
Sep 29
Replied to a topic by ccctttwww › 问与答 › AI 时代下,隐私还有意义吗
和 AI 不 AI 没关系,只要踏进互联网就相当于裸奔了
Aug 5
Replied to a topic by sjjgpt › 程序员 › 收到律师函了,不让用了
DBeaver 。有一说一 UI 虽然丑,但功能不是这些新工具能比的。
Mar 5
Replied to a topic by lewin18 › OpenClaw › openclaw 搭建好了却不知道用来干嘛
吹的人都是骗小白买课的
Dec 4, 2024
Replied to a topic by jeremye › TypeScript › 请教一个 TS 问题,不知能否实现
```ts
interface Options<T extends any> {
a: () => T;
b: (p: T) => void;
}

type ConfigType<T extends Record<string, Options<any>>> = {
[K in keyof T]: {
a: () => T[K]['a'];
b: (p: ReturnType<T[K]['a']>) => void;
};
};

function defineConfig<T extends Record<string, Options<any>>>(options: T): ConfigType<T> {
return options;
}

const config = defineConfig({
item1: {
a: () => ({ id: 1 }),
b: (params) => {}, // params 类型是 { id: number }
},
item2: {
a: () => ({ name: '1' }),
b: (params) => {}, // params 类型是 { name: string }
},
});

config.item1.b({ id: 1 }); // ok
config.item1.b({ name: '1' }); // error

config.item2.b({ id: 1 }); // error
config.item2.b({ name: '1' }); // ok
```
Nov 18, 2024
Replied to a topic by gdw1986 › macOS › 大家现在都用什么输入法?
mac 微信、win QQ 、安卓 讯飞
银行推销会不会自动给机主贷款
m2 pro 现在有点溢价,不如再加点上 m3 pro
14 寸模具压得住 m3 max 吗
毛都没,还在每个人桌子边上摆块牌子,我的是好好编程,努力赚钱
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3361 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 11ms · UTC 11:15 · PVG 19:15 · LAX 04:15 · JFK 07:15
♥ Do have faith in what you're doing.