问题描述
我正在尝试创建一个 JS 入门项目,但 ionic start xxx --v2
创建了一个打字稿项目.
I am trying to create a JS starter project but ionic start xxx --v2
creates a typescript project.
我需要创建一个 JS 入门项目,以便我可以将现有的 JS ionic 2 应用复制到全新安装.
I need to create a JS starter project so I can copy across an existing JS ionic 2 app to a clean installation.
我确实尝试将我所有的 JS 文件重命名为 typescript,但得到了大量的错误消息:
I did try renaming all of my JS files to typescript but a get a shed load of error messages of the type:
属性 xxx 在类型 yyy 上不存在
推荐答案
就像你可以阅读 离子文档:
Ionic 2 应用程序默认创建为 TypeScript.
想改用 JavaScript 吗?传递 --no-ts
标志并得到一个而是为 JavaScript 设置项目.
Want to use JavaScript instead? Pass the --no-ts
flag and get a project set up for JavaScript instead.
所以你需要运行
ionic start xxx --v2 --no-ts
================================
==============================
你说得对.这似乎是文档或 Ionic CLI 中的错误.在这个commit中,您可以看到标题是remove javascript as a option对于 v2 项目...... 和 here 在最后的评论中,他们提及有关更新文档的内容(因为它说想要改用 JavaScript?传递 --no-ts 标志并为 JavaScript 设置项目.).
You're right. It seems to be a bug either in the documentation or in the Ionic CLI. In this commit you can see the title is remove javascript as an option for v2 projects ... and here in the last comment they mention something about updating the docs (because it says Want to use JavaScript instead? Pass the --no-ts flag and get a project set up for JavaScript instead.).
您可以关注此帖子看看 Ionic Team 是否有人回答了这个问题.
You can follow along this post to see if someone from Ionic Team answer about this issue.
==============================
=============================
编辑 2:
刚刚在 ionic-v2
Slack 频道中提问,答案是:
Just asked in ionic-v2
Slack channel and the answer was:
我们将全力投入 TS.
你可以自己完成工作并将其转换为 es6 工作流程,但我们希望人们使用 typescript
You could do your own work and covert it toa es6 workflow, but we want people to use typescript
这篇关于使用 ionic 2 而不是打字稿应用程序创建一个 javascript 入门应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!