Make constructors protected/private and add static constructor methods (of/from/with)
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 625
- Avg merge
- 5h 23m
- Merged PRs (30d)
- 24
Description
### Feature description
As discussed on Discord, the classes of `PgSelectSingle`, `PgSelect` etc. are not supposed to be used for anything except `instanceof` checks. I propose we make it impossible to construct them using `new`.
This means the constructor should either be `protected` or `private`, and each class will require an additional static method to construct said class.
Open questions:
* What should the name of the factory method be on each class? (`PgSelect.from`, `PgSelect.with`, `PgSelect.of`, etc.)
* Should the constructors be `private` or `protected`?
* Which classes does this apply?
### Supporting development
I [tick all that apply]:
- [ ] am interested in building this feature myself
- [ ] am interested in collaborating on building this feature
- [ ] am willing to help testing this feature before it's released
- [ ] am willing to write a test-driven test suite for this feature (before it exists)
- [ ] am a [Graphile sponsor](https://www.graphile.org/sponsor/) ❤️
- [ ] have an active [support or consultancy contract](https://www.graphile.org/support/) with Graphile
Contributor guide
Assessment
This issue has not been assessed yet.