i have problem with task relaying on format Y axis to display only natural numbers. In project i am using React awith Typescript and Nivo Rocks library to create charts (https://nivo.rocks/).for the purpose of this question i created sandbox:
https://codesandbox.io/s/scuqn?file=/src/App.tsx
i found a solution to set format:
axisLeft={{
format: e => Math.floor(e) === e && e
}}
/>
but it works only with pure js (no type checking). with TS there is a type error (with 'e:number'):
No overload matches this call.
Overload 1 of 2, '(props: LineSvgProps | Readonly<LineSvgProps>): ResponsiveLine', gave the following error.
Type '(e: number) => number | undefined' is not assignable to type 'string | TickFormatter | undefined'.
Type '(e: number) => number | undefined' is not assignable to type 'TickFormatter'.
Types of parameters 'e' and 'value' are incompatible.
Type 'string | number | Date' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
Overload 2 of 2, '(props: LineSvgProps, context: any): ResponsiveLine', gave the following error.
Type '(e: number) => number | undefined' is not assignable to type 'string | TickFormatter | undefined'.
Type '(e: number) => number | undefined' is not assignable to type 'TickFormatter'.ts(2769)
i can't match types to this solution and i can't use 'any' type, i am starting to believe the library creators didn't predict this problem in their library ;) if anyone can help me with these or suggest another solution i will be greatful :)