/ ink / components / AppContext.ts
AppContext.ts
 1  import { createContext } from 'react'
 2  
 3  export type Props = {
 4    /**
 5     * Exit (unmount) the whole Ink app.
 6     */
 7    readonly exit: (error?: Error) => void
 8  }
 9  
10  /**
11   * `AppContext` is a React context, which exposes a method to manually exit the app (unmount).
12   */
13  // eslint-disable-next-line @typescript-eslint/naming-convention
14  const AppContext = createContext<Props>({
15    exit() {},
16  })
17  
18  // eslint-disable-next-line custom-rules/no-top-level-side-effects
19  AppContext.displayName = 'InternalAppContext'
20  
21  export default AppContext