📄 File detail

hooks/useTerminalSize.ts

🧩 .ts📏 16 lines💾 354 bytes📝 text
← Back to All Files

🎯 Use case

This file lives under “hooks/”, which covers reusable UI or integration hooks. On the API surface it exposes useTerminalSize — mainly functions, hooks, or classes. Dependencies touch React UI and src.

Generated from folder role, exports, dependency roots, and inline comments — not hand-reviewed for every path.

🧠 Inline summary

import { useContext } from 'react' import { type TerminalSize, TerminalSizeContext, } from 'src/ink/components/TerminalSizeContext.js'

📤 Exports (heuristic)

  • useTerminalSize

📚 External import roots

Package roots from from "…" (relative paths omitted).

  • react
  • src

🖥️ Source preview

import { useContext } from 'react'
import {
  type TerminalSize,
  TerminalSizeContext,
} from 'src/ink/components/TerminalSizeContext.js'

export function useTerminalSize(): TerminalSize {
  const size = useContext(TerminalSizeContext)

  if (!size) {
    throw new Error('useTerminalSize must be used within an Ink App component')
  }

  return size
}