-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Differences with ditox #33
Comments
Hi. Thanks for your questions!
You’re right. However, I can say “warning prone” rather than “error prone”. I’m thinking about how to improve the DX of Brandi. Ditox’s approach looks great, I may will to implement a similar approach with a compile-time check.
You can call
Thank you 🙏. Your idea about instance generation is not clear to me. Can you give an example? |
// Define tokens for injections.
// Token can be optional to provide default values.
const TOKENS = {
service: token<ServiceInterface>('Token description for debugging'),
};
const TAGS = {
tag1: token<'val1' | 'val2'>('Token description for debugging'),
};
// Create the container.
const container = createContainer();
// Provide a value to the container.
container.bindValue(TAGS.tag1, 'val1')
// Dynamic values are provided by factories.
container.bindFactory(
TOKENS.service,
injectable((tag: 'val1' | 'val2') => tag === 'val1' ? new Service() : new MockService(), TAGS.tag1),
); |
Hello! As the author of Ditox.js, I'm happy to meet a library that shares similar concepts. It's interesting that although the development of both libraries was started around the same time, and different design decisions were applied, but the APIs share similar features and ideas. This allows to hope that the implemented APIs will be quite stable in the long run. As for the functionality of the libraries - they differ in detail. For example, Ditox.js doesn't have |
Hello!
I saw a library called ditox which has almost same interface like your library do and several questions emerged:
.inSomeScope()
more error prone then ditox's{scope:"some"}
argument? I sometimes forgive to add these scope calls and only remember that when see warnings in consoleI wrote this issue not to clash you and @mnasyrov but to know your position on these design decisions. I already use your library in some projects and it might be better for others who find your or ditox to know which one fits their case best.
P.S. @mnasyrov @vovaspace don't you think it'll be great to have links to each other's projects to increase awareness of options?
The text was updated successfully, but these errors were encountered: