I am trying to declare type for components props as shown below:
type TSPaymentFormProps = {
paymentAmountType: string,
totalAmount: number,
prolongationAmount: number,
currentProcListInfo: object,
customAmount: number,
invalidAmount: boolean,
handleAmountChange: any,
setPaymentType: function
}
The last one should be labeled as function but I am getting error cannot find name 'function'. How do I do it?
setPaymentType: (param1:string, param2:number) => void-- fill in your actual parameters and types.Functionis a type in TS that accepts any function. However, in general, it shouldn't be used because it accepts any function, rather than ones with signatures you expect.setPaymentType: (paymentType: PaymentType) => void