Thursday, 15 August 2013

javascript - Working with TypeScript -


We are planning on going to Kangaroo 2 and use this type of script because it has many advantages (readability, maintenance e.t.c) . After reading some blogs on that, I came in the following part of the code and found (Left - typecript and correct equivalent JS code)

Enter image details here

In view of the following code like this,

  var firstBadAlien = new BadAlien ('dodobbesbadelien', 0, 5, 000) with the above TS code;  

I should give a compile time error if I do not supply required exact type arguments which is good.

I have the following questions:

  1. What if this code runs on the browser dynamically and the user presents wrong type arguments. It will fail to check the type because there is no type of inquiry on the equivalent JS prepared for it.

  2. Is there a way to test type type or to generate JS also by checking the type of time? Suppose I want to argue that like 'number' and it can add JS code to type type 'isFinite ()'?

Thank you.

What if this code runs on the browser dynamically and the user logs incorrectly Offers. This type of test will fail because there is no type of inquiry on the equivalent JS prepared for it.

The impression is that you will use the type of script code to call your typecript code, and typecheck it. Something else will just pass through. If you accept boolean from the user in any way, it will fail on runtime.

What type of scripts are the only way to check, or is there a way to generate JS also by checking the type of time? Suppose I want the argument to be number number and it can add JS code to type type 'isFinite ()'?

Not yet


No comments:

Post a Comment