|
|
|
|
|
by eddd-ddde
779 days ago
|
|
Duck typing can lead to a false sense of security when you /think/ you have Foo when in reality you have Bar with the same shape. Also Typescript sucks at keeping track of type changes in a single scope. While in Rust I can assign string to foo and then update it with int, I can't in Typescript. This leads to worse types or worse code for the same operation. Combined with typescript's lack of statements as values, conditionally initializing a value is pretty obtuse. Those are the issues that come to mind right now. |
|
This is literally always your problem with javascript, its only sometimes your problem with typescript. It's a weird argument.
> Also Typescript sucks at keeping track of type changes in a single scope.
Isn't this considered a very bad practice? Also rust does not allow this, it only allows shadowing.
> Combined with typescript's lack of statements as values, conditionally initializing a value is pretty obtuse.
Can you give an example?