Ionic 2: why is ionic g page giving me .js files?

I am adding pages and providers to a Beta 11 project using Ionic generate and it creates them as JavaScript (JS) files and not TypeScript, this has never happened on previous Beta releases for me.

I’ve resolved it for now by adding --ts (like this ionic g page new-page-name --ts) but it seems odd that it defaults to giving me JS files seeing as JS support has been dropped.

System Info

Cordova CLI: 5.4.0                     
Gulp version:  CLI version 3.8.11      
Gulp local:   Local version 3.9.1      
Ionic Framework Version: 2.0.0-beta.11 
Ionic CLI Version: 2.0.0-beta.36       
Ionic App Lib Version: 2.0.0-beta.19   OS:                                    
Node Version: v4.4.2

This is weird behaviour I came across, this never happened to me.

@william_harris Is this happened to you after upgrading to
Ionic Framework Version: 2.0.0-beta.11
Ionic CLI Version: 2.0.0-beta.36 ??

With ionic2 beta-10 by default it provides ts file. Right.

Yes it seems that way. Before beta 11 it always gave me .ts files and today I created my first beta 11 project using the side menu template and it gives me .js files.

I updated the CLI to the latest version (beta 36) but it still gives .js files, so I’m not sure what causes this.

I’ve just gone back to an old beta 10 project and it still defaults them to .ts files so I will guess it is something to do with the beta 11 release that is causing this. I’ve only tested on the side menu template though.

@william_harris
I’m also facing some issues after upgrading to Ionic Framework Version: 2.0.0-beta.11 and
Ionic CLI Version: 2.0.0-beta.36.

After upgrading to this latest beta-11 release, my previous project which is created in beta-10 with sidemenu starter not working properly. My sidemenu’s not working.

Is your sidemenu's working well with beta11??

Do you have this in your ionic.config.json?

“typescript”: true

@daimyo I do have "typescript": true in my ionic.config.json

No it currently looks like this

{
  "name": "project-name",
  "app_id": "",
  "v2": true
}

Maybe that’s the problem for me / the default side menu template.

Is that something I can just manually enter into the file without breaking anything?

Yes try to add it like here…

1 Like

My side menu works but that is because I created a new project and not updating an old one. When I say it works I mean the default template does, I’m in the process of moving across the pages and providers etc,

I would recommend starting a new beta 11 project if you are getting problems and just move code across (not ideal but hopefully should work).

That has worked for me thanks!

1 Like