CyberProdigy
CyberProdigy

Reputation: 999

How to stop visual studio warning about presence of 'public' modifier

I have typescript class

class UserModel
{
    public vipTiers: Array<VipTierDto>;
    public games: Array<GameDto>;
}

This results in showing me this warning in VisualStudio 2015, TypeScript 2.0.6 Your code style requires absence of 'public' modifiers

Obviously I prefer to keep the private/public modifiers. Where can I set the coding style?

This is my tsconfig.json

{
  "compileOnSave": true,
  "compilerOptions": {
    "module": "commonjs",
    "noImplicitAny": true,
    "preserveConstEnums": true,
    "removeComments": true,
    "sourceMap": true
  },
  "include": [
    "**/*.ts"
  ]
}

Upvotes: 4

Views: 260

Answers (1)

mlessard
mlessard

Reputation: 523

I think this warning comes from ReSharper and not Visual Studio. If using ReSharper you can go to ReSharper --> Options --> TypeScript --> Code Style. Then check "Use explicit 'public' modifier". Works for me.

Upvotes: 1

Related Questions