問題描述
我正在嘗試創建一個 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
這篇關于使用 ionic 2 而不是 typescript 應用程序創建一個 javascript starter 應用程序的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!