Skip to content

Function: createFeatureSelector()

createFeatureSelector<T, P>(slice): (state) => undefined | P extends keyof T ? T[P<P>] : P extends readonly string[] ? ValueAtPath<T, P<P>> : unknown

Defined in: selectors.ts:34

Selects a nested property from a plain object state using a path of keys.

Type Parameters

T

T = any

The root state object type.

P

P extends string | number | symbol | readonly string[] = keyof T

A key of the object or a path array.

Parameters

slice

P

The key or path to the desired nested value.

Returns

A selector function that takes a plain object state and returns the nested value.

(state): undefined | P extends keyof T ? T[P<P>] : P extends readonly string[] ? ValueAtPath<T, P<P>> : unknown

Parameters

state

T

Returns

undefined | P extends keyof T ? T[P<P>] : P extends readonly string[] ? ValueAtPath<T, P<P>> : unknown

Released under the MIT License.