【发布时间】:2018-12-23 03:57:28
【问题描述】:
我最近安装了一个用于 React Native 的新包。与其他包一样,我在 Visual Studio Code 中被提示:
[ts]
Could not find a declaration file for module 'react-native-material-
dropdown'. '/home/stumfi-mobile/123-app/node_modules/react-native-
material-dropdown/index.js' implicitly has an 'any' type. Try `npm
install @types/react-native-material-dropdown` if it exists or add a new
declaration (.d.ts) file containing `declare module 'react-native-
material-dropdown';`
通常这是一个微不足道的修复,因为我只需键入:
npm install @types/react-native-material-dropdown
但是今天失败了。我了解到 npm 最近遇到了一些令牌被泄露的问题:
npm WARN notice Due to a recent security incident, all user tokenshave
been invalidated. Please see
https://status.npmjs.org/incidents/dn7c1fgrr7ng for more details. To
generate a new token, visit https://www.npmjs.com/settings/~/tokens or
run "npm login".
在调查了他们的链接后,我决定我需要手动进行此操作(并希望能学到一些东西)。我在哪里创建包含 `declare module 'react-native-material-dropdown' 的文件 (.d.ts) 文件
【问题讨论】:
标签: reactjs react-native npm npm-install