Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use proper Typescript practices for setters and getters #133

Open
wltrf opened this issue Mar 23, 2020 · 1 comment
Open

Use proper Typescript practices for setters and getters #133

wltrf opened this issue Mar 23, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@wltrf
Copy link
Collaborator

wltrf commented Mar 23, 2020

The classes under ./classes all implement the setProp() and getProp() methods while also leaving the property itself public. This should be changed to follow proper practices which looks like the following:

private _value : string;
public get value() : string {
  return this._value;
}
public set value(v : string) {
  this._value = v;
}

This allows to call the prop directly as if it was a public property, but in the background it actually calls the proper set or get methods.
E.g. calling instance.prop="test" will be actually call the set method.

@wltrf wltrf added the enhancement New feature or request label Mar 23, 2020
@wltrf
Copy link
Collaborator Author

wltrf commented Mar 23, 2020

  • building.ts
  • CampusEvent.ts
  • campus.ts
  • compoundPath.tsx
  • fastestPathCalculator.ts
  • googleMapsAdapter.ts
  • location.ts
  • outdoorPOI.ts
  • pointOfInterest.ts
  • transportMode.ts
  • trip.ts
  • unitPath.tsx

wltrf added a commit that referenced this issue Mar 29, 2020
Make properties private.
Changed accessor and mutator methods.
Add endDate property.
Add ES6 target in tsconfig.
See issue #133 for more details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant