问题标签 [typescript1.5]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
typescript - 使用 for..of 和 Map 会生成无效的 ES5
我在将最新的 TypeScript 1.5 编译器与Map
和结合使用时遇到问题for..of
。例子:
据此, TypeScript 1.5 支持解构和 for..of 所以我真的不明白为什么这不应该工作,但它输出无效的 ES5:
我通过使用解决了这个问题,map.forEach((value, key) => { ... });
但它不如for..of
.
这是 1.5 版本的限制吗?当它不受支持时,我是否希望它转换Map
为 ES5?
angularjs - Angularjs 打字稿迁移
我有一个相当大的 angularjs 应用程序,我最终将迁移到 Angular 2。
我想采取我现在可以采取的任何步骤,使未来的迁移更容易。
我正在将我的控制器和服务转换为打字稿,并将我的文件组织在面向组件的文件夹结构中。
我真正想做的是使用 es6 样式的模块加载。
我知道 system.js 现在可以提供加载功能,我可以在 typescript 1.5 中使用 es6 import 语法。
我的问题是,我应该如何将两者结合使用?我应该从 typescript 输出 es6 模块并使用 system.js 模块加载生成的代码吗?还是需要其他步骤?
javascript - 打字稿中的 ES6 地图
我正在 typescript 中创建一个类,它的属性是 ES6 (ECMAscript 2016) Map,如下所示:
如何在 typescript 中声明 ES6 Map 类型?
angular - typescript angular2.d.ts 错误“期待新行或分号”
我最近WebStorm10.0.2
提出的关于"angular2.d.ts"
“期待新行或分号”的错误。在第 15-19 行和第 32-37 行。
Angular2 团队在 5 分钟开始示例中犯了错误?我不敢相信,这一定是我的错。
所以:
我按照“angular2 的 5 分钟快速入门”(https://angular.io/)一步一步克隆。
我已经将 'index.html' 和 'app.ts' 从 'complete' 移动到 Base-Path。
我还将WebStorm10.0.2
编译器版本更改为包含 typescriptService.js 的自定义目录。
还是不行...
我的打字稿版本是 1.5Beta。
windows - 为什么在 Mac 上编译 TypeScript 比在 PC 上快得多?
一个项目需要我的 ThinkPad X1(i7-5500U 2.4-3.0GHz + 512G PCI-e SSD,Windows 10 build 10074)大约 5 秒编译在 i5 MacBook Pro(2.6GHz)上只需要 3 秒,不到 6 秒在低端 MacBook Air 上。
是什么造成了这里的巨大差异?
asp.net-core - 如何在 Visual Studio 2015 RC 中为 ASP.NET 5 MVC 6 项目设置 TypeScript 编译器版本?
所以我现在对此一无所知。正如标题中的问题所问的那样,我正在尝试为示例 ASP.NET 5 MVC 6 项目设置 tsc 版本。我正在使用 Visual Studio 2015 RC,我想使用最近发布的 1.5 Beta 版编译 TypeScript。在 VS 2013 中,这是项目属性中的一个选项页面。我以为我可以设置一些神奇的 project.json 值,但没有。如果我什至可以关闭编译(1.4 版)并使用 Gulp 任务,即使这样我也可以算作进度。
typescript - Typescript 1.5 模块导入导出错误
我在我的打字稿项目中重新导出时遇到问题
我有类图层,我这样声明它:
我还有另一个文件可以重新导出所有相关文件
编译时出现以下错误:
还有另一个相关错误:使用 export 关键字声明接口时,如下所示:
我再次收到此错误:
typescript - 使用装饰器获取已实现接口的列表
你知道是否可以使用装饰器获取类实现的接口数组:
所以如果我这样做:
在运行时忍者将有一个注释,其中包含["INinja", "IWarrior"]
?
谢谢
intellij-idea - AngularJS 2.0 TypeScript Intellij 想法(或 webstorm) - ES6 导入语法
尝试执行这些步骤以使AngularJS 2.0 示例应用程序运行。
在这一步,将代码放入 app.ts:
得到最新的 14.1.3 IntelliJ IDE
。
但似乎它不明白'import'
(突出抱怨)
问:是不是因为它还不支持 TypeScript 1.5?(它的IDE设置我可以看到嵌入式1.4版本)。可以用那个IDE编译吗?
typescript - Declare Typescript global variable as "module" type
I have the React type definition file (that is declared using an external module). In my source files, I usually do:
and can then happily use R.createElement(...
etc in a strongly typed fashion.
What I want is to not have to import R
in every file, and instead have it as a global declaration (yes, I'm willing to polute the global namespace with a few variables). I've tried:
This doesn't work though, I get "Cannot find name 'React'"
. Is there another way to export the entire module as global?
Edit 1 -
I should have made clearer: I'm interested in how to export a global type definition in a .d.ts
file. So assume I've attached R
to window
already. Now I need typescript to know that R
is of type React module
.