我使用的是 Visual Studio 2013 和最新的 Typescript 编译器 1.6.2,但定义文件仍然存在问题。对于每个具有用于指定各种类型参数的管道符号的方法声明,我都会出错。查看screenshot对于 jquery text() 方法参数类型错误。
最佳答案
Pipe “|” symbol is causing errors in typescript definition file
这称为 union
类型,并且在 TypeScript 1.6 中得到明确支持。检查您的 visual studio tsc 版本 (tsc -v
)。
关于typescript - 管道 "|"符号导致 typescript 定义文件中出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33612615/