Maintain clear and explicit code organization patterns by following these guidelines: 1. Use explicit property visibility in classes: - Prefer public properties over getters/setters when no additional logic is needed
Maintain clear and explicit code organization patterns by following these guidelines:
Example:
// โ Avoid
export * from './utils';
import { something } from './index';
class MyClass {
private messages: Message[];
getMessages() { return this.messages; }
}
// โ
Better
export { generateId, parseConfig } from './utils';
import { something } from './something';
class MyClass {
#internalState: string;
messages: Message[]; // public property when no special handling needed
}
This pattern improves code maintainability, makes dependencies clear, and helps control your public API surface.
Enter the URL of a public GitHub repository