File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,14 @@ export function noop() {}
93
93
* throughout the codebase and provides a clean way to handle the common pattern where
94
94
* options can be static values or dynamic functions.
95
95
*
96
+ * The NonFunction<T> constraint eliminates ambiguity by ensuring T can never be a function
97
+ * type. This makes the value-or-function pattern type-safe and unambiguous.
98
+ *
99
+ * The function provides two overloads: one that includes `| undefined` for optional values
100
+ * (where the value might not be provided), and another without `| undefined` for required
101
+ * values. This allows proper type inference for both optional config parameters and
102
+ * required ones while maintaining type safety.
103
+ *
96
104
* @template T - The type of the resolved value (constrained to non-function types)
97
105
* @template TArgs - Array of argument types when resolving function variants
98
106
* @param value - Either a direct value of type T or a function that returns T
You can’t perform that action at this time.
0 commit comments