TypeScript-Handbook icon indicating copy to clipboard operation
TypeScript-Handbook copied to clipboard

getter and setter in example are using a private name with "_"

Open isometriq opened this issue 7 years ago • 3 comments

According to: https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines 6. Do not use "_" as a prefix for private properties.

The getter/setter example here: https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Classes.md ..is not examplary.

isometriq avatar Apr 08 '17 22:04 isometriq

feel free to send a PR to change it to name

mhegazy avatar Aug 14 '17 23:08 mhegazy

Actually it's as intended, and those are our own coding guidelines.

image

The reason it needs to be underscored is that we need some name for the backing field. What would you call it otherwise?

DanielRosenwasser avatar Aug 31 '17 21:08 DanielRosenwasser

The reason it needs to be underscored is that we need some name for the backing field. What would you call it otherwise?

name instead of _fullName?

mhegazy avatar Aug 31 '17 22:08 mhegazy