简体   繁体   English

Ionic 2 使用 .ts 而不是 .js 文件

[英]Ionic 2 using .ts instead of .js file

Currently I started learning ionic2 and it install .ts file for me automatically instead of .js file .目前我开始学习ionic2并且它会自动为我安装.ts file而不是.js file

May someone guide me how to solve this problem?有人可以指导我如何解决这个问题吗?

Thank you.谢谢。

Dont start the project with the --ts option不要使用--ts选项启动项目

Edit:编辑:

I just tested ionic start appName --v2 and it correctly creates a javascript project.我刚刚测试了ionic start appName --v2并且它正确地创建了一个 javascript 项目。 The output from ionic info is this: ionic info的输出是这样的:

Cordova CLI: 6.1.1
Ionic Framework Version: 2.0.0-beta.7
Ionic CLI Version: 2.0.0-beta.25
Ionic App Lib Version: 2.0.0-beta.15
OS:
Node Version: v5.10.1

All new Ionic v2 projects started will be TypeScript.所有新启动的 Ionic v2 项目都将是 TypeScript。 Ionic team have removed the option to generate new projects using JavaScript. Ionic 团队删除了使用 JavaScript 生成新项目的选项。 So there are no further options like --js, --no-ts, or --ts flags because they are no longer relevant as Typescript is a superset of Js因此没有更多选项,例如 --js、--no-ts 或 --ts 标志,因为它们不再相关,因为 Typescript 是 Js 的超集

More details are here - https://forum.ionicframework.com/t/typescript-project-files-named-js/54674/17更多细节在这里 - https://forum.ionicframework.com/t/typescript-project-files-named-js/54674/17

Ionic 2 using .ts instead of .js file Ionic 2 使用 .ts 而不是 .js 文件

Quickest way.最快的方式。 Rename the .js file to .ts and then start fixing any errors..js文件重命名为.ts ,然后开始修复任何错误。

JavaScript is TypeScript so your runtime behavior will not change 🌹 JavaScript 是 TypeScript,所以你的运行时行为不会改变 🌹

More更多

https://basarat.gitbooks.io/typescript/content/docs/why-typescript.html https://basarat.gitbooks.io/typescript/content/docs/why-typescript.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM