sandly 3.0.0 → 3.0.1

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +8 -1
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -165,9 +165,16 @@ type WithBuilderTags<TBuilder, TNewTags extends AnyTag> = TBuilder extends Scope
165
165
  * - A ServiceTag (class) whose instances are assignable to T
166
166
  * - A ValueTag whose value type is assignable to T
167
167
  * - A raw value of type T
168
+ *
169
+ * The conditional uses `[T] extends [object]` (tuple-wrapped) to prevent
170
+ * distribution over union types. Without this, a parameter typed as a
171
+ * string union (e.g. `'SANDBOX' | 'PRODUCTION'`) would distribute into
172
+ * `ValueTag<any, 'SANDBOX'> | ValueTag<any, 'PRODUCTION'>`, and a
173
+ * `ValueTag<any, 'SANDBOX' | 'PRODUCTION'>` would not be assignable to
174
+ * either branch (ValueTag is invariant in its value parameter).
168
175
  * @internal
169
176
  */
170
- type ValidDepFor<T> = (T extends object ? ServiceTag<T> | ValueTag<any, T> : ValueTag<any, T>) | T;
177
+ type ValidDepFor<T> = ([T] extends [object] ? ServiceTag<T> | ValueTag<any, T> : ValueTag<any, T>) | T;
171
178
  /**
172
179
  * Maps constructor parameters to valid dependency types.
173
180
  * Each parameter type T becomes ValidDepFor<T>.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sandly",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "keywords": [
5
5
  "typescript",
6
6
  "sandly",