从 DefinitelyTyped 安装正确的类型

Installing the right typings from DefinitelyTyped

我正在尝试为 malihu-custom-scrollbar-plugin(typings) 安装 typings(版本 1.3.2 atm)。 我正在使用以下命令:

typings install dt~mcustomscrollbar --save --global

这会安装稍后被识别为错误的类型(错误 TS1110:预期类型。)因为使用了字符串文字类型语法,例如:axis?: "x"|"y"|"xy".

我检查了 DT 存储库,发现在 types-2.0 分支中,类型没有使用这种语法,我想知道并试图找到一种方法来安装这些语法,而不是默认安装的语法.

有什么办法可以实现吗? 至少比手动修复 index.d.ts 文件中的问题更好。

P.S。我用 typings install <location> 选项愚弄了周围,但我无法正确使用它,也找不到任何好的文档应该如何使用它。

您可以直接从 github 安装类型并指定所需的提交:

typings install github:DefinitelyTyped/DefinitelyTyped/mCustomScrollbar/mCustomScrollbar.d.ts#41f8573534b0fff88707d0a4cb870456b50cd43b --save --global

其中 41f8573534b0fff88707d0a4cb870456b50cd43b 是提交。