typescript - 管道 "|"符号导致 typescript 定义文件中出现错误

标签 typescript

我使用的是 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/

相关文章:

javascript - Angular 两次发送 http 请求

mysql - MySQL 数据库中的日期未显示在 Angular View 中

自定义响应式(Reactive)表单验证器中的 Angular 多个错误

javascript - 如何使用 AMD 模块从纯 js 中创建 TypeScript 类的对象实例

typescript - 引用没有名称的类以在 TypeScript 的子类中使用不同的静态方法

Angular Select with ngFor 更改第一个选择会影响第二个选择

typescript - 是否可以为方法装饰器选项提供类型安全

typescript - 如何防止递归条件在 TypeScript 中无限?

typescript - ionic2 中的导入指令 - ng2-qrcode

javascript - 通过字符串注入(inject)和解析 Angular2 提供程序