Re:TypeScript support in Electron
by z3t4 on Friday June 02, 2017 @02:13PM
(#14472127)
does typescript know if a parameter is undefined (misspelled) or does it only find errors like 1+'1' ?
[ Parent
| on HN ]
It is a full static checking system, so it will find obvious errors like mistyping something, but it also infers alot of information from the context.
I made a small simple demo here: https://www.typescriptlang.org/play/index.html#src=const%20e...
Note: Click Options and enable all the settings. Typescript works best in strict mode, but it seems options arn't including in sharing via url.
It seems it can only find properties if they are defined as foo = {bar: 1}; and not foo={};foo.bar=1;
it'll throw an error if a parameter is undefined, and https://github.com/Microsoft/TypeScript/issues/15333 which lands in the next version auto-suggests spelling corrections as well
Of course. That's table stakes for any static type checking.
In fact to set a global value (ex: window.Foo) requires a bit of extra work to instruct the type check that your new property is not errant.
Re:TypeScript support in Electron
by fdsfsafasfdas on Friday June 02, 2017 @05:15PM
(#14473361)
What is the error in 1+'1'? It seems like it would just be '11'.
Unless, of course, you're implying it converts javascript into a strongly typed language, which would be amazing.