Skip to content

Commit ff79c93

Browse files
authored
Add types
Closes GH-1. Reviewed-by: Junyoung Choi <[email protected]> Reviewed-by: Christian Murphy <[email protected]> Reviewed-by: Merlijn Vos <[email protected]> Reviewed-by: Titus Wormer <[email protected]>
1 parent 729a5d8 commit ff79c93

5 files changed

Lines changed: 34 additions & 2 deletions

File tree

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@
2424
"contributors": [
2525
"Titus Wormer <[email protected]> (https://wooorm.com)"
2626
],
27+
"types": "types/index.d.ts",
2728
"files": [
28-
"index.js"
29+
"index.js",
30+
"types/index.d.ts"
2931
],
3032
"dependencies": {},
3133
"devDependencies": {
3234
"browserify": "^16.0.0",
35+
"dtslint": "^3.6.12",
3336
"nyc": "^15.0.0",
3437
"prettier": "^2.0.0",
3538
"rehype-stringify": "^8.0.0",
@@ -49,7 +52,8 @@
4952
"build": "npm run build-bundle && npm run build-mangle",
5053
"test-api": "node test",
5154
"test-coverage": "nyc --reporter lcov tape test.js",
52-
"test": "npm run format && npm run build && npm run test-coverage"
55+
"test-types": "dtslint types",
56+
"test": "npm run format && npm run build && npm run test-coverage && npm run test-types"
5357
},
5458
"nyc": {
5559
"check-coverage": true,

types/index.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// TypeScript Version: 3.4
2+
3+
import {Plugin} from 'unified'
4+
5+
declare const remarkBreaks: Plugin<[]>
6+
7+
export = remarkBreaks

types/remark-breaks-tests.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import unified = require('unified')
2+
import breaks = require('remark-breaks')
3+
4+
unified().use(breaks)

types/tsconfig.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["es2015"],
4+
"strict": true,
5+
"baseUrl": ".",
6+
"paths": {
7+
"remark-breaks": ["index.d.ts"]
8+
}
9+
}
10+
}

types/tslint.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "dtslint/dtslint.json",
3+
"rules": {
4+
"semicolon": false,
5+
"whitespace": false
6+
}
7+
}

0 commit comments

Comments
 (0)