typedi
typedi copied to clipboard
feat: list of various doc updates
Description
This issue describes a list of various updates to the documentation.
General
- [ ] explain that injection only happens when class created via
Container.get - [ ] explain cyclic dependency injection only works with property injection
- [ ] add example for mocking classes with TypeDI
- example:
Container.set({ id: MyRealClass, type: MyMockedClass }) - example:
Container.set({ id: MyRealClass, value: { doStuff: () => console.log('mocked') }})
- example:
- [ ] explain difference between setting values with
typeandvalue - [ ] explain how custom factories work (class and function factories
- eg:
@Service({ factory: [CarFactory, 'create'] }) - eg:
@Service({ factory: carFactory })
- eg:
- [ ] explain
multiple: truewhen registering services - [ ] explain how services are overwritten when re-registered
- this needs extra implementation: allow throwing error when service already exists
- [ ] explain container inheritance
- this needs implementation, current behaviour will change
- [ ] add documentation for configuration with Babel (to retain type metadata emitted by Typescript)
@Service decorator
- [ ] add documentation for named services (eg:
@Service('scopeA.myservice'))- can be injected with the same name only (eg:
@Inject('scopeA.myservice'))
- can be injected with the same name only (eg:
@Inject decorator
- [ ] explaining that only constructable types are auto-inferred (eg: you must provide ID for a string value