3 ms·
Well you could use the Python approach of "we are all adults" and allow people to do the wrong thing if they are explicitly asking to do it. I do believe it's
by true_religion 8y ago
Well you could use the Python approach of "we are all adults" and allow people to do the wrong thing if they are explicitly asking to do it.
I do believe it's better to be strict but allow a loophole just in case future use requires it.
For example in my codebase, only valid objects can be created via User.create but we do create invalid ones for testing since it's not necessary to have full objects there.
- stemmlerjs 8y agoThat's pretty funny. I like that. Yeah, I'd say it definitely depends on your project and your team. There are also ways to opt-in and out of following rules like this, even from a TypeScript context- you just have to be more aggressive about it. For example, you could access private methods by doing: User['create']() for example. Sometimes this is necessary for testing.