我尝试使用 type-fest GreaterThan 类型作为函数参数,但出现错误
当我编写以下函数时:
import type {GreaterThan} from 'type-fest'
function printNumberOfBooks <N extends number> (numberOfBooks: GreaterThan<N, 0>): void {
console.log(numberOfBooks)
}
还有...:
printNumberOfBooks(2)
我收到以下打字稿错误:
“number”类型的参数不可分配给“never”类型的参数
我花了几个小时......我没有找到解决方案