如果我以不同的方式定义对象,则TypeScript Intellisense的工作原理会有所不同 [英] TypeScript Intellisense works differently if I define Object in Different Ways

查看:91
本文介绍了如果我以不同的方式定义对象,则TypeScript Intellisense的工作原理会有所不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用TypeScript转换一些现有的JavaScript代码,我正在使用的一个示例是创建Highcharts类,Highcharts定义来自

I am trying to convert some existing JavaScript code by using TypeScript, One example I am using is to create Highcharts classes, the Highcharts definition is from https://github.com/borisyankov/DefinitelyTyped/blob/master/highcharts/highcharts.d.ts

我们都知道HighchartsOptions具有属性title.

We all know HighchartsOptions has a property title.

如果我以这种方式定义对象,则我具有智能感

If I define the object in this way, I have intellisense

但是如果我这样定义对象

But if I define object this way

我没有智慧.

Visual Studio行为不同的任何特定原因吗?

Any specific reason why Visual Studio behaves differently?

推荐答案

这只是一个错误.请参阅有关CodePlex的问题,以跟踪该问题何时得到修复.

It's just a bug. See this issue on CodePlex to track when it gets fixed.

这篇关于如果我以不同的方式定义对象,则TypeScript Intellisense的工作原理会有所不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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