Here is my function:
const payout = (asset: ILPAsset, type: string)
=> type === 'daily' ? asset.lastPayout : asset.historical;
And where I'm using it:
@bind
private mapDailyAssets(payoutType: string, payout: payoutFunc, assets: ILPAsset[], currency: string) {
return assets.map((asset) => (
<div className={b('table-row')()} key={asset.symbol}>
<div>{asset.symbol}</div>
<div className={b('asset-value')()}>{formatMoney(payout(asset, payoutType), currency)}</div>
</div>
));
}
I'm getting errors when trying to set an interface for type payoutFunc:
interface payoutFunc: (asset: ILPAsset, type: string) => string;
But also getting this error:
invoke an expression whose type lacks a call signature
