microsoft / TypeScript-Handbook

Deprecated, please use the TypeScript-Website repo instead
https://github.com/microsoft/TypeScript-Website
Apache License 2.0
4.88k stars 1.13k forks source link

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

Open isometriq opened 7 years ago

isometriq commented 7 years ago

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.

mhegazy commented 7 years ago

feel free to send a PR to change it to name

DanielRosenwasser commented 7 years ago

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?

mhegazy commented 7 years ago

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?