如何在TypeScript中将键添加到函数类型?

例如:

const myFunc = () => 'result';
myFunc.myKey = 'value';

type func = () => string;
// AND
type func = {
    myKey: string;
}

我如何定义myFunc的类型?

谢谢!

转载请注明出处:http://www.xiangbinbaiyi.com/article/20230505/1306962.html