Typescript: How to define type for a function callback (as any function type, not universal any) used in a method parameter

前端 未结 8 1028
刺人心
刺人心 2020-11-30 17:19

Currently I have type definition as:

interface Param {
    title: string;
    callback: any;
}

I need something like:

inter         


        
8条回答
  •  没有蜡笔的小新
    2020-11-30 17:46

    Following from Ryan's answer, I think that the interface you are looking for is defined as follows:

    interface Param {
        title: string;
        callback: () => void;
    }
    

提交回复
热议问题