What’s real benefit of using TypeScript in app development?

I’m alright with programming as of now. I think I can handle future project with typescript then I was questioning what it truly improves in development environment.
I think trying virtual DOM based front end on Capacitor can potentially solve speed problem.
I highly recommend this path if react or vue can be implemented on capacitor one day.

Virtual DOM is definitely faster than what angular is using. React renders UI up to twice faster than angular. Vue claims to be faster than React. On desktop, we can’t feel much difference because desktop CPU is very powerful but on a smartphone which comes with an inferior CPU, that’s a different story.
I think if Ionic team conduct experiment on this, it would be great. They should choose a front end framework that makes ionic app as fast as native java & objective c apps.

Why don’t you conduct that experiment?
Instead of expecting other to do it you could lead the way.

1 Like

Yeah, I will do that in my spare time but honestly I don’t know how to implement Ionic UI on react & vue.js.

I’ve seen an app which uses virtual DOM style js UI on PhoneGap. It has HTML files in js files. It renders UI from js.

This app is surprisingly as fast as native app… maybe a bit slower than real native but I would say it’s 95% close to native feel.

and here’s its source code:

Yes, I’m interested in testing js based virtual dom front end on capacitor. I will try to do experiment and publish results although ionic team doing it professionally with team members would be better…

Stencil.js seems to have a solution for that:

I spend almost my all career doing Java. Without Typescript it would have been way more harder to learn Ionic/Angular.

Furthermore, right now I have to work for a couple of months on a not typed ExtJs project. Every time I have to code something in that project I just freaking miss typescript. Without types it’s just hell, like searching something in a dark room without light switches

5 Likes

Yeah, I figured typescript and java are pretty similar…

I’m sure virtual dom rendering is the future for ionic app. I hope Ionic team implement this to ionic 4 … no one should be making slow apps in 2018.

@reedrichards

I wouldn’t bother too much if you get paid by the hour instead of fixed price

:sunglasses::sunglasses:

2 Likes

Hahaha :joy:

You definitely got some flair for business

P.S.: My app is my own product aka more time I spend, more broke I become :wink:

1 Like

Haha yes. Then I would probably go with pure JS and dont use Plugins and Node or something. I would programm all sh*t by myself :smiley:

1 Like

@reedrichards

then this advice is on me then :slight_smile:

2 Likes

Pretty much ALL slow apps are NOT down to using Ionic or React or Typescript whatever, they’re down to people doing stupid things then blaming the framework instead of themselves.

Stupid things like:

  • Waiting for data from slow services
  • Downloading huge payloads from end points unnecessarily
  • Unnecessarily using plugins they don’t need <- this is almost always the case
  • Large payload sizes, packing in the kitchen sink worth of assets etc
  • Sloppy loops in their code
  • Not working to the strengths of the framework instead trying to fight the tide

If you are working on an Ionic app and it’s slow, that’s down to YOU - learn more!

1 Like

looool,
if you are not a real programmer go with javascript…
if you ask why typescript, i don’t think u will ever understand it…

beside, typescript IS javascript… omg

Virtual DOM is getting implemented on Ionic 4:

I’m glad the team knew the issue.
So Ionic 4 will use stencil.js which uses virtual DOM to render UI.

Virtual DOM is a missing piece of Angular. That’s why ionic app is generally slower than native apps.

If you guys test on laptop or desktop, you guys may not feel that difference at all but you can on low end smartphones. Ionic components like modal, ion-segment are very slow on low-mid smartphones. They take 1.5+ second to respond.

Again, that is not my programming fault or anything… that’s way they are seriously

Three solutions I suggested are:

  • Implement virtual DOM to Ionic version angular (Google didn’t do it and they didn’t make it for creating smartphone apps running on cordova)
  • Use vue.js for UI
  • Use react.js for UI

and stencil.js will do that on Ionic 4:

stenciljs.com

Your post has nothing to do with Typescript. Also this sentence

is not quite accurate. Stencil is a transpiler, sort of like tsc for web components. The flow is more or less:

You → Stencil → Web components → Rendering framework (eg Angular) → HTML in the DOM

Parallel to:
You → Typescript → Javascript with Angular decorators → Rendering framework (Angular) → HTML in the DOM

I don’t read @mhartington’s post there as saying they are adding a Virtual DOM to Angular, but rather they are going to play well with frameworks that use a virtual DOM. In fact, I would be SHOCKED if Angular added a virtual DOM. Two-way binding in a virtual DOM would be hard to get performant. (Impossible maybe?) Vue and React offer only one-way binding.

4 Likes

Well I’m suggesting possible solutions which may work.

This thread is a random topic regarding what you guys think about use of angular & typescript in general and if there’s better way than sticking with angular.

We will see… Stencil and Ionic 4 are in beta so maybe they end up as something different later on.
But right now, stencil does fulfill what I was requesting…

Stencil is javascript based by the way. It uses JSX from React.js. Don’t bash javascript!
https://jsx.github.io/

faster
JSX performs optimization while compiling the source code to JavaScript. The generated code runs faster than an equivalent code written directly in JavaScript. The gain may vary, but even the optimized JavaScript libraries like Box2D becomes faster when ported to JSX (12% faster on iOS 5.1, 29% faster on Android 2.3).

There’s a reason that makes react faster than angular.
JSX & Virtual DOM combined could make UI rendering on Ionic faster just as much as react does on react native.

Sure, and you can program that in Typescript React. I think you’re confusing Typescript with Angular. Probably vanilla React will stay most popular among independent developers. But larger companies (employers) will stick with Angular or add TS to their React. Types and linting provide better long-term code stability, and make it easier to work on code in teams. You are only measuring one aspect of speed. Speed of development and speed of maintaining code also matter.

That’s all true and Angular will solve any problem easily.
But when speed is concerned … especially on mobile devices running a WebView app, I think using JSX and Virtual DOM based solution makes a lot of sense. They both intended for increasing speed.
The problem of putting everything in a single WebView wrapper is it makes apps slower… because a single container needs to solve all problems in app. That’s not how native java apps are usually built.
In that case, you have to look up for the fastest solution which minimizes the downside of framework.
Using React that is based on JSX and Virtual DOM is a way… and upcoming Stencil.js is another way…