UNPKG

1.89 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/window-size`
3
4# Summary
5This package contains type definitions for window-size (https://github.com/jonschlinkert/window-size).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/window-size.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/window-size/index.d.ts)
10````ts
11/// <reference types="node" />
12
13declare module "window-size" {
14 import { WriteStream } from "fs";
15
16 const windowSize: windowSize.Size & {
17 /** Get terminal window's size with available channels. */
18 get(options?: windowSize.WindowSizeOptions): windowSize.Size;
19 /** Get terminal window's size with `process.env.COLUMNS` and `process.env.ROWS`. */
20 env(): windowSize.Size;
21 /** Get terminal window's size with `tty` module */
22 tty(options: windowSize.TtySizeOptions): windowSize.Size;
23 tput(): windowSize.Size;
24 win(): windowSize.Size;
25 };
26 export = windowSize;
27 namespace windowSize {
28 export interface Size {
29 width: number;
30 height: number;
31 type: string;
32 }
33
34 /** Options of inner function `streamSize`. */
35 type StreamSizeOptions = Record<string, WriteStream>;
36
37 /** Options of function `windowSize.tty`. */
38 interface TtySizeOptions {
39 tty?: {
40 getWindowSize?: (out: WriteStream) => [number, number];
41 };
42 }
43
44 /** Options of function `windowSize.get` */
45 type WindowSizeOptions = StreamSizeOptions & TtySizeOptions;
46 }
47}
48
49````
50
51### Additional Details
52 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
53 * Dependencies: [@types/node](https://npmjs.com/package/@types/node)
54
55# Credits
56These definitions were written by [Juer Whang](https://github.com/juergenie).
57
\No newline at end of file