Typescript HTMLElement 禁用 1.4 到 1.6 发生了什么 (TS2339)? [英] Typescript HTMLElement disabled 1.4 to 1.6 what happened (TS2339)?

查看:18
本文介绍了Typescript HTMLElement 禁用 1.4 到 1.6 发生了什么 (TS2339)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 Visual Studio 2013 和 TS 语言的 1.4 版本进行 TypeScript 项目.刚刚我升级了使用 TS 1.6 的 Visual Studio 2015.

I have been working on a TypeScript project using Visual Studio 2013 and the 1.4 version of the TS language. Just now I've upgraded the Visual Studio 2015, which uses TS 1.6.

我有使用 HTMLElement 的禁用"属性的代码:var e: HTMLElement = ...e.disabled = true;

I have code that uses the "disabled" property of an HTMLElement: var e: HTMLElement = ... e.disabled = true;

VS 2015/TS 1.6 现在给我错误代码 TS2339:属性 'disabled' 在类型 'HTMLElement' 上不存在.

VS 2015/TS 1.6 now gives me error Code TS2339: "Property 'disabled' does not exist on type 'HTMLElement'.

哇!'disabled' 是一个 DOM 属性,它曾经在我的代码中做一些事情,现在它不再定义了?它去了哪里,我该如何处理?

Whoa! 'disabled' is a DOM property, and it used to do something in my code, and now it's no longer defined? Where did it go, and how do I deal?

我已经仔细阅读了从 1.4 到 1.6 的 TS 版本的新增功能"说明,但在这件事上没有什么可说的.

I've carefully read the 'What's New' notes on the TS release from 1.4 to 1.6 but it has nothing to say on this matter.

推荐答案

对应于 MDN 主题HTMLElement 类没有 disabled 等属性.这就是 Typescript 开发团队更正这个 Web API 对象的原因

Corresponding to MDN topics, class HTMLElement does not have property such as disabled. That is why Typescript developers team correct this Web API object

这篇关于Typescript HTMLElement 禁用 1.4 到 1.6 发生了什么 (TS2339)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆