I tried using type-fest GreaterThan type for the function parameter and got an error
when I write the following function:
import type {GreaterThan} from 'type-fest'
function printNumberOfBooks <N extends number> (numberOfBooks: GreaterThan<N, 0>): void {
console.log(numberOfBooks)
}
and… :
printNumberOfBooks(2)
I get the following typescript error:
Argument of type ‘number’ is not assignable to parameter of type ‘never’
It took me hours… I didn’t find a solution