You can determine if the problem is with Visual Studio by specifying the wrong TypeScript version by following these steps.
Put this sample code in C:\Temp\app.ts
interface Metadata { something: string; } export class SomeClass { protected metadata: Metadata; protected subItems: SomeClass[]; constructor() { } } export class OtherClass extends SomeClass { constructor() { super(); this.metadata = null; } } var x = new SomeClass();
Run the command:
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.1>tsc --module amd c:\Temp\app.ts
Making sure you specify folder 1.1
in the TypeScript SDK folder.
The output should be:
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.1>
i.e. nothing except that you have the app.js. file
You can also re-run the test after uncommenting the line x.metadata = null;
- at this moment you should get an error:
c: /Temp/app.ts (22,1): error TS2445: property metadata is protected and accessible only in the SomeClass class and its subclasses.
Next steps...
If the above fails , please provide details of the problem.
The only real answer that we could give, although it will delete it, and verify that folder 1.1 is gone before reinstalling it by extracting the installer from the Microsoft website (maybe you have a bad installation or some problem during installation? ) You can also check that you are in Visual Studio Update 4, since I am testing it on Update 4.
If the above worked as expected , your Visual Studio is not pointing to the correct version.
This may be due to the project file, as Dick van den Brink correctly mentioned. Make sure you have <TypeScriptToolsVersion>1.1</TypeScriptToolsVersion>
and that this is the only element with this name.
It may also not be available for any Visual Studio extensions that may interact with your TypeScript (for example, if you had a really old version of Web Essentials - in this case, update it - if it is a different extension, try disabling it).