Closed
Description
TypeScript Version: 2.1.1 (RC)
In our code we use several constants at the top of typescript files to store class config data. For example, we might want to limit the number of operations that can be performed simultaneously, but tweak the value from time to time. After upgrading to typescript@rc, this code no longer compiles
Code
const maxPeople = 4;
class Race {
// Compiles under 2.0.8, Doesn't compile under 2.1.1-rc
multiPersonRace(): boolean {
return maxPeople > 1;
}
}
See https://github.com/berickson1/Playground/blob/master/constError.ts
Expected behavior:
Code compiles
Actual behavior:
constError.ts(5,16): error TS2365: Operator '>' cannot be applied to types '4' and '1'.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
normalser commentedon Nov 10, 2016
#10120 #11134
mhegazy commentedon Nov 10, 2016
closing in favor of #10120