

TypedJS: Sanity Check your JavaScript   - unignorant
http://typedjs.com/

======
secoif
Please don't use non-commercial licences: you are greatly limiting the number
of people who can _afford_ to contribute to your project.

~~~
spacemanaki
Furthermore I don't think CC licenses are meant to be used for code:
<http://creativecommons.org/software>

------
timothya
Interesting, but if I wanted to get this sort of validation I'd just use
Google's Closure Compiler. It supports validating types and also lets you do
things like casting variables to different types. And the annotation method is
pretty clear, flexible, and easy to understand.

------
silentOpen
Can the implementation be typed?
<https://github.com/Proxino/TypedJS/blob/master/typed.js>

------
glymor
At first glance this is a fuzz generator not a type checker.

------
silentOpen
What is the license that is free for non-commercial use? Static type checking
is nice but implementation in a non-statically-type-checked language is
unfortunate.

------
cromwellian
I think Closure Compiler is a lot more useful than this. You get type
checking, but you also get best of breed optimization/minification too.

You don't get the automatic runtime test generation stuff, but that's more
along the lines of an add-on utility like Quickcheck/Scalacheck.

------
zoka
The add_all() function as presented on their web page is wrong,instead of
adding the array elements it just returns the last one.

Line 180 should be: count += num_arr[i];

Moreover naming accumulation variable for sum "count" is totally counter
intuitive.

------
TeamMCS
Interesting idea but I'd _hate_ to maintain that.

------
wyuenho
How much performance hit would it costs, and is there a companion tool that I
can remove only those comments with types?

------
tbassetto
I never saw someone using "nil" in JavaScript (even in a comment). I guess the
author has a Ruby background.

------
perfunctory
From their home page example

if(obj.valid === true) {

I would flag this line as an error.

~~~
inimino
Why? obj is specified by the type annotation to be an object with a property
'valid' that is a Boolean, so what's the problem?

~~~
perfunctory
I just don't like this style very much. It's better to write

if (obj.valid) {

~~~
nilved
`if (foo)` and `if (foo === true)` aren't equivalent.

~~~
Hovertruck
According to the TypedJS annotation for the function they are. The function
definition says that obj.valid has to be a boolean, so any other type of falsy
input (0, undefined, null, etc) should never be provided as an argument here.

------
kevingadd
It would be more interesting if you could also use the annotations to type-
check at runtime (optionally). That way if the annotations diverged from the
actual code, you'd find out.

