Using Context.Tag for Type-Safe Context Resolution in Code Splitting
Hey, today i have been working on a code splitting problem in terms of context providers being imported from other modules.
Instead of importing directly, every module now registers its own context in a context registry. Because the registry itself has no dependencies on any modules, the problem is solved.
Now, the next problem is, that you have to export your types and cast whatever you get from the registry. There's also no way to guarantee the provided key resolves whatever it is casted to.
So the question is, can i use something similar to how Effect is using Context.Tag, such that you can import both as a value and as a type. This way it is also possible to match the provided key against the one of the type?
Instead of importing directly, every module now registers its own context in a context registry. Because the registry itself has no dependencies on any modules, the problem is solved.
Now, the next problem is, that you have to export your types and cast whatever you get from the registry. There's also no way to guarantee the provided key resolves whatever it is casted to.
So the question is, can i use something similar to how Effect is using Context.Tag, such that you can import both as a value and as a type. This way it is also possible to match the provided key against the one of the type?
