Answer the question
In order to leave comments, you need to log in
What is the order of class members in TypeScript?
Tell me, in what order is it customary to list the elements of a class in TypeScript?
By class element, I mean all sorts of fields, methods ...
Answer the question
In order to leave comments, you need to log in
We adopted this order on projects
public-static-field
protected-static-field
private-static-field
public-instance-field
protected-instance-field
private-instance-field
constructor
public-static-method
protected-static-method
private-static-method
public-instance-method
protected-instance-method
private-instance-method
One of the most important rules. All the same, intelligence and navigation in ide will be used.
The most general approach is the properties in a bunch and the constructor at the beginning, the statics are also somewhere nearby, everything else (no one will look for this with their hands anyway) later.
Something more strict - already unnecessary bureaucracy.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question