Ionic 2 not recognize typescript gramma

So a few things

ionic 2.0.0-beta.25 is the version of the ionic CLI

You could add necessary build steps needed for an typescript app:

# add build task 
npm install ionic-gulp-browserify-typescript --save-dev

Replace

var buildBrowserify = require('ionic-gulp-browserify-es2015');

with

var buildBrowserify = require('ionic-gulp-browserify-typescript');

And add a tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true
  },
  "filesGlob": [
    "**/*.ts",
    "!node_modules/**/*"
  ],
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

Finally, add this to your ionic.config.json

{
  "name": "<yourappname",
  "app_id": "",
  "v2": true,
   // add this 
  "typescript": true
}

From there, you could rename all your files to .ts and you should be good.

2 Likes