-
Notifications
You must be signed in to change notification settings - Fork 13
Upgrade to Typescript 2.1 #39
Comments
The following fails to compile. function edit() {
let lyst: string[] = ["foo", "bar"]
if(lyst.length !== 111){
return "foo"
}
if(lyst.length !== 222){
return "bar"
}
} This looks like a compiler bug to me at first glance - or we've been doing it wrong. |
This succeeds: function edit() {
let lyst: Array<string> = ["foo", "bar"]
if(lyst.length !== new Number(111)){
return "foo"
}
if(lyst.length !== new Number(222)){
return "bar"
}
} |
It looks as if the compiler is assigning lyst.length the type '111' and therefore the comparison fails. |
This is probably a manifestation of: because the following is fine: function edit() {
let lyst: string[] = ["foo", "bar"]
if(lyst.length !== <number>111){
return "foo"
}
if(lyst.length !== <number>222){
return "bar"
}
} |
What should we do about this now? So we try again with 2.1? |
So some of these issues are related to the TypeScript type system being super (too) smart, but there are some genuine show-stoppers, unless I'm missing something: |
So @cdupuis - I think we should go ahead and upgrade to 2.1.5. The TS guys do not consider these to be bugs - it's for developers to work around. So if we're sticking with TS, we should keep moving forward IMO. |
I've now updated the compiler and released a new version 0.11.0. |
The text was updated successfully, but these errors were encountered: