About variable typing performance in functions and variables in typescript

Asked

Viewed 51 times

0

There is some difference in typescript performance when using variable typing compared to any?

Example:

minhaString: any;
minhaString: string;

I would also like to know if there is a difference in typing the function return, example:

minhaFuncao(){}

e minhaFuncao():void{}

This typing would help in performance in some way or is it more to follow design standards?

Is there a study that shows the difference in performance when a function/variable is declared as public, private, protected...?

  • Performance where? You know that Typescript is only one superset and that in the end everything becomes JS?

  • Thank you, so there is no difference in typing or not the variables and returns? That’s what I asked. I felt your answer kind of gross

  • I’m starting now

  • It wasn’t the intention, but don’t confuse being direct with being rude. I needed to understand if you even had a sense of what you’re working on. Asking performance is always very delicate. Hardly anyone who asks specifies which parameters to consider when comparing performance. The way you put it looked like you wanted to know if the final application changes with the type of the variable and so I asked if you knew what Typescript really was.

  • If you’re starting now, I recommend you study JS before TS.

  • 1

    About having difference between typing see on the playground that the generated code is the same http://www.typescriptlang.org/play/#src=Let%20test%3A%20string%3B%0D%0Alet%20teste2%3B%0D%0A%0D%0Aclass%20testeClass%7B%0D%0A%20%20%20public%20test%3D1%3B%0D%0A%20%20%20private%20teste2%3D3%3B%0D%0D.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.