on-internet
← Community

Understanding Typescript Record type with React's useContext

Stack Overflow ·

I'm having some issues understanding the record type in a generator function I'm developing for React contexts. Here's my generator function: import * as React from 'react' export type State = Record<string, unknown> export type Action = { type: string; payload?: unknown } // eslint-disable-next-line @typescript-eslint/ban-types export type Actions = Record<string, Function> export type AppContext = { state: State; actions: Actions } export type Reducer = (state: State, action: Action) => State type ProviderProps = Record<string, unknown> type FullContext = { Context: React.Context<AppContext>

Comments

Sign in or sign up to comment and upvote.

No comments yet.