Closed
Description
We have a convention of using the _serviceBrand
-properties on arguments that get injected to constructors. This is to break structural typing and to make sure IInstantiationService#createInstance
bubbles back those (non-service) types it needs to be called with.
The _serviceBrand
-property is typed as any
and different usages patterns have emerged - full text search for _serviceBrand!?: .*?(;|,)
.
This should be cleaned up like so
- make the type
undefined
- so that strict-init-tricks aren't needed, e.g. this
_serviceBrand!: ServiceIdentifier<ILifecycleService>;
and - so that
_serviceBrand
isn't assigned values (it's a compile time thing only)
- so that strict-init-tricks aren't needed, e.g. this
- rename the property to
_injectableBrand
because this is about types being injected, not necessarily services.