使用 ionic 2 而不是 typescript 应用程序创建一个 javascript starter 应用程序
我正在尝试创建一个 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:
类型 yyy 上不存在属性 xxx
Property xxx does not exist on type yyy
推荐答案
就像你可以阅读 离子文档:
Ionic 2 应用程序默认创建为 TypeScript.
Ionic 2 applications are created as TypeScript by default.
想改用 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 an option对于 v2 项目 ... 和 这里 在他们最后的评论中提到一些关于更新文档的事情(因为它说 想改用 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:
我们将全力以赴.
您可以自己完成工作并将其转换为 es6 工作流程,但我们希望人们使用 typescript
You could do your own work and covert it toa es6 workflow, but we want people to use typescript
相关文章