forked from pmmmwh/react-refresh-webpack-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
29 lines (29 loc) · 1004 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* Sets a constant default value for the property when it is undefined.
* @template T
* @template {keyof T} Property
* @param {T} object An object.
* @param {Property} property A property of the provided object.
* @param {T[Property]} [defaultValue] The default value to set for the property.
* @returns {T[Property]} The defaulted property value.
*/
export function d<T, Property extends keyof T>(
object: T,
property: Property,
defaultValue?: T[Property] | undefined
): T[Property];
/**
* Resolves the value for a nested object option.
* @template T
* @template {keyof T} Property
* @template Result
* @param {T} object An object.
* @param {Property} property A property of the provided object.
* @param {function(T | undefined): Result} fn The handler to resolve the property's value.
* @returns {Result} The resolved option value.
*/
export function n<T, Property extends keyof T, Result>(
object: T,
property: Property,
fn: (arg0: T | undefined) => Result
): Result;