Reputation: 5594
In Visual Studio 2015, if i write a .ts file with:
class MyClass {
public pageSize: number;
}
no errors are marked (underlined). If i write instead
class MyClass1 {
public readonly pageSize: number;
}
i get weird underlines, but the code compiles. Any clue?
Thanks
Upvotes: 1
Views: 420
Reputation: 164397
The readonly properties was only introduced in typescript 2, so if you want to use it then you have to compile using typescript 2.
Your code is compiled in the playground without errors as it uses typescript 2.
Here's how to use it with visual studio.
Upvotes: 1