3 ms·
I really like the type system in Powershell and wish JavaScript had something similar. Typescript is a mess by comparison. [string]$String = "Dog"; $Stri
by stephengillie 8y ago
I really like the type system in Powershell and wish JavaScript had something similar. Typescript is a mess by comparison.
[string]$String = "Dog";
$String = 5;
Cannot convert value 5 to type "System.Objects.String"
- int_19h 8y agoThis produces a similar error ("Type 5 is not assignable to type 'string'") when compiled with TS: var s: string = "Dog"; s = 5; The difference is that it's a compile-time error, while in PowerShell it's a run-time check. But what's the difference in this case? Either way, it tells you.
- stephengillie 8y agoThe biggest difference - not needing to compile - is offset by the slowness of Powershell. If only one language was best across all metrics.