Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require Node.js 8, add TypeScript definition #9

Merged
merged 1 commit into from Apr 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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