【发布时间】:2023-03-23 22:37:01
【问题描述】:
我已经安装在一个打字稿项目中:
"@types/lodash": "4.14.150",
"loadash": "4.17.15",
通过lodash/fp 处理的所有数据都返回为any
以下代码没有报错:
import {prop} from 'lodash/fp';
const data: { id: string } = { id: 'hello' }
// from the above we know that id is a string, but typing it as a number doesn't report any errors
const meh: number = prop('id')(data)
不添加number的类型,可以看到返回类型是any
请问我该如何解决这个问题? 谢谢
【问题讨论】:
标签: typescript lodash typescript-typings