Skip to content

Commit

Permalink
Require Node.js 8, add TypeScript definition (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
BendingBender authored and sindresorhus committed Apr 28, 2019
1 parent 7048807 commit 85e3e8e
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -4,6 +4,6 @@ os:
- windows
language: node_js
node_js:
- '12'
- '10'
- '8'
- '6'
21 changes: 21 additions & 0 deletions index.d.ts
@@ -0,0 +1,21 @@
declare namespace termSize {
interface TermSize {
columns: number;
rows: number;
}
}

/**
Reliably get the terminal window size.
@example
```
import termSize = require('term-size');
termSize();
//=> {columns: 143, rows: 24}
```
*/
declare function termSize(): termSize.TermSize;

export = termSize;
6 changes: 6 additions & 0 deletions index.test-d.ts
@@ -0,0 +1,6 @@
import {expectType} from 'tsd';
import termSize = require('.');

const size: termSize.TermSize = termSize();
expectType<number>(size.columns);
expectType<number>(size.rows);
10 changes: 6 additions & 4 deletions package.json
Expand Up @@ -10,13 +10,14 @@
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
"node": ">=8"
},
"scripts": {
"test": "xo && ava"
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts",
"vendor"
],
"keywords": [
Expand All @@ -37,7 +38,8 @@
"execa": "^1.0.0"
},
"devDependencies": {
"ava": "^1.0.1",
"xo": "^0.23.0"
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}
2 changes: 1 addition & 1 deletion readme.md
Expand Up @@ -28,7 +28,7 @@ termSize();

### termSize()

Returns an `Object` with `columns` and `rows` properties.
Returns an `object` with `columns` and `rows` properties.


## Related
Expand Down

0 comments on commit 85e3e8e

Please sign in to comment.