How do I add custom formatters for rivets in TypeScript?

180 Views Asked by At

I'm trying to add a couple of custom formatters, but I keep getting this error.

[ts] Element implicitly has an 'any' type because type 'Object' has no index signature.

This is how I'm registering my custom formatters.

rivets.formatters['fromNow'] = (value: number, now: number): string => {
    return humanizeDuration((now - value) * 1000);
};

For the record, I am using noImplicitAny set to true in my tsconfig.json file.

0

There are 0 best solutions below