I’m wondering if it’s possible to use TypeScript by the project generated by ionic2-cli? Because by default they’re all .js files.
You can no generate an all-ts project by iniating a new project with a --ts flag.
Great. It works. Thank you.
I am a little confused about what exactly is going on with Ionic 2 in terms of how the code is bundled.
I see a .tsconfig.json file, which implies typescript. However, all of my generated files from the started template are js. I don’t see any babel configuration or anything like that, so I certainly seem to be writing typescript.
When I use the VS Code editor, it is pretty unhappy with the .js files and doesn’t let me use typescript features. For example, I can’t use async functions without the editor giving me an error because it isn’t treating my files as typescript.
When I put an obvious syntax error into my code that babel would never compile, webpack just seems to do it’s thing happily and not notify me of any errors. Shouldn’t the typescript compiler bite it and let me know it can’t build the bundle? Ultimately, I do see an error in my console in the browser, but that feels pretty late in the process.
Is the expected way to write Ionic apps in straight JS (es6? es5?) and just use the Typescript compiler for decorators?
In general - I find the whole thing very confusing. It’s not like I’m new to transpiling either. For a large Ionic 1 app I built, I have enabled ES6/7 functionality via babel and browserify, so I am familiar with bundling, etc.
danbucholtz_brady, like I wrote, start your project using the ts-flag. We’re working on a project of a larger scale now, and have managed to setup what feels like I really solid environment. I use VS Code as well, and my colleagues use Webstorm - both work just fine. We’ve even included TSLint into our project, and Code shows reference error, TS errors and linting errors perfectly.
I’m using Atom. It always give some error messages for the typescript.