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

Add TypeScript definition #20

Merged
merged 3 commits into from
Apr 17, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export const info: string;

/**
@example
```
import logSymbols = require('log-symbols');

console.log(logSymbols.success, 'Finished successfully!');
// On good OSes: ✔ Finished successfully!
// On Windows: √ Finished successfully!
```
*/
export const success: string;

export const warning: string;

export const error: string;
BendingBender marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 7 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {expectType} from 'tsd';
import logSymbols = require('.');

expectType<string>(logSymbols.info);
expectType<string>(logSymbols.success);
expectType<string>(logSymbols.warning);
expectType<string>(logSymbols.error);
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts",
"browser.js"
],
"keywords": [
Expand All @@ -39,12 +40,13 @@
"stdout"
],
"dependencies": {
"chalk": "^2.4.1"
"chalk": "^2.4.2"
},
"devDependencies": {
"ava": "^0.25.0",
"strip-ansi": "^5.0.0",
"xo": "^0.23.0"
"ava": "^1.4.1",
"strip-ansi": "^5.2.0",
"tsd": "^0.7.2",
"xo": "^0.24.0"
},
"browser": "browser.js"
}
1 change: 1 addition & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import logSymbols from '.';
for (const key of Object.keys(logSymbols)) {
console.log(logSymbols[key], key);
}

console.log('');

test('returns log symbols', t => {
Expand Down