Finding information is quite challenging as I'm not sure about its name and can only infer its function from the context. It's being used in the example provided below.
https://github.com/piotrwitek/react-redux-typescript-guide#typing-reducer
// inferring union type of actions
import { $call } from 'utility-types';
import * as actions from './actions';
const returnsOfActions = Object.values(actions).map($call);
export type TodosAction = typeof returnsOfActions[number];
Particularly interested in the last line. The use of number
here is not explicitly defined but seems to iterate through the array returnOfActions
. Essentially, is this equivalent to:
export type TodosAction = ActionType1 | ActionType2 | ...
And what would you classify this syntax as (to aid in further research)?