This repository was archived by the owner on Apr 21, 2024. It is now read-only.
This repository was archived by the owner on Apr 21, 2024. It is now read-only.
Allow out-of-order dependencies registration #2
Open
Description
Problem description:
Right now, it's only possible to register dependencies in order. This helps achieving type safety, but it's not strictly necessary.
Proposed solution:
-
We could "save" type information in some sort of "associated type" when we register new factories with unmet dependencies (without changing the type of its resolvers, to avoid exposing factories with unmet dependencies).
-
Later, when we register the dependencies, we could take this type information from the "associated type" and use it to "fix" the getters' type, to expose the factories that were hidden before.
Final considerations
This might prove to be difficult, not because of the feasibility of designing the types, but because they might end up being too complex for the TSC type cheker.