Using ionic g to generate a page creates a js file instead of ts file. Perhaps the command should find out if the project was created --ts or the user should pass in --ts to ionic g.
$ ionic g page MyPage
+1
+1 same for the provider
i can't find a way to generate ts pages
After running ionic g page MyPage I always manually rename the .js file to .ts. The content is still typescript for me, but the filename extension is wrong.
Thats what i ended up doing. Thanks
When i generate ionic g page something-page the class is SomethingPagePage which is incorrect, it doesnt happen on provider tho. Please add -ts support and fix this issue...
+1
+1
+1
Hello all! We have now added typescript generators. With the latest beta cli (beta.25) you can simply append --ts to your generate command to use typescript. Thanks for using Ionic!
The --ts could not be by default? Or detect your type of config when you created the project ?
Hello @rpayanm as of recently we have gone all in with Typescript. This means that all our generators and starters are Typescript only now and we do not provide a Javascript version. So when you generate a page with the cli now, you will get the typescript version without having to use any flags! If you would like to read more about this you can check this article out. Thanks for using Ionic!
Thank you @jgw96.
Now I created the project from scratch like this:
$ ionic start MyProject blank --ts --v2
and when I generated a page for example:
$ ionic g page MyPage
This generated a .ts instead of .js
But.....
If I created the project like this (whithout --ts):
$ ionic start MyProject blank --v2
and when I generated a page for example:
$ ionic g page MyPage
This generated a .js instead of .ts, it is the behavior expected ?
Greetings.
@rpayanm No problem! What version of the cli are you running? To find this out easily you can simply run ionic info or ionic version. Thanks!
$ ionic info
Cordova CLI: 6.1.1
Gulp version: CLI version 1.2.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.9
Ionic CLI Version: 2.0.0-beta.24
Ionic App Lib Version: 2.0.0-beta.14
OS: Distributor ID: Debian Description: Debian GNU/Linux 8.5 (jessie)
Node Version: v4.4.7
Ahh, it seems you are running an old version of the cli. Would you mind running sudo npm install -g ionic@beta to update your ionic cli installation? Thanks! PS: you may or may not need sudo depending on how you have your debian install set up, and where you have node.js installed. Most likely though, you do need sudo.
:+1:
Thank you @jgw96
No problem @rpayanm !
Is there any command to rename page automatically in ionic 2?
Most helpful comment
Hello all! We have now added typescript generators. With the latest beta cli (beta.25) you can simply append
--tsto yourgeneratecommand to use typescript. Thanks for using Ionic!