@lppedd/di-wise-neo 0.26.0 → 0.26.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -75,10 +75,6 @@ interface Type<T> extends ParameterDecorator {
75
75
  * An injectable type `T` with a default {@link Provider} and optional default registration options.
76
76
  */
77
77
  interface ProviderType<T> extends Type<T> {
78
- /**
79
- * The underlying `Type<T>`.
80
- */
81
- readonly type: Type<T>;
82
78
  /**
83
79
  * The type's default provider.
84
80
  */
@@ -440,7 +436,10 @@ interface Container {
440
436
  */
441
437
  register<Value, ProviderValue extends Value>(token: Token<Value>, provider: ValueProvider<ProviderValue>): Container;
442
438
  /**
443
- * Removes all registrations for the given token from the container's internal registry.
439
+ * Removes registrations for the given token from the container's internal registry.
440
+ *
441
+ * When a `name` is provided, only the registration with that `name` is removed.
442
+ * Otherwise, all registrations are removed.
444
443
  *
445
444
  * Returns an array of the distinct values that were cached by this container for the
446
445
  * removed registrations. Values from {@link ValueProvider} registrations are not included,
package/dist/cjs/index.js CHANGED
@@ -453,7 +453,6 @@ function createType(debugName, provider, options) {
453
453
  type.__type = undefined;
454
454
  type.toString = ()=>name;
455
455
  if (provider) {
456
- type.type = type;
457
456
  type.provider = provider;
458
457
  type.options = options;
459
458
  }
@@ -792,7 +791,7 @@ function isDisposable(value) {
792
791
  // Register the class itself
793
792
  this.myTokenRegistry.put(Class, registration);
794
793
  // Register additional aliasing tokens specified via class decorators.
795
- // These tokens will point to the original Class token and will have the same scope.
794
+ // These tokens will point to the original class token and will have the same scope.
796
795
  for (const aliasToken of metadata.tokenRef.getRefTokens()){
797
796
  this.myTokenRegistry.put(aliasToken, {
798
797
  name: name,
@@ -816,9 +815,10 @@ function isDisposable(value) {
816
815
  check(name === undefined || name.trim(), `name qualifier for token ${getTokenName(token)} must not be empty`);
817
816
  if (isClassProvider(provider)) {
818
817
  const metadata = getMetadata(provider.useClass);
818
+ // An explicit provider name overrides what is specified via @Named
819
+ const effectiveName = name ?? metadata.name;
819
820
  const registration = {
820
- // An explicit provider name overrides what is specified via @Named
821
- name: metadata.name ?? name,
821
+ name: effectiveName,
822
822
  provider: metadata.provider,
823
823
  options: {
824
824
  // Explicit registration options override what is specified via class decorators (e.g., @Scoped)
@@ -827,16 +827,17 @@ function isDisposable(value) {
827
827
  },
828
828
  dependencies: metadata.dependencies
829
829
  };
830
+ // Register the class itself
830
831
  this.myTokenRegistry.put(token, registration);
831
832
  // Register additional aliasing tokens specified via class decorators.
832
- // These tokens will point to the original token and will have the same scope.
833
+ // These tokens will point to the original class token and will have the same scope.
833
834
  for (const aliasToken of metadata.tokenRef.getRefTokens()){
834
835
  this.myTokenRegistry.put(aliasToken, {
835
- name: name,
836
+ name: effectiveName,
836
837
  provider: {
837
838
  useExisting: [
838
839
  token,
839
- name
840
+ effectiveName
840
841
  ]
841
842
  }
842
843
  });