Skip to content

Commit

Permalink
Add types
Browse files Browse the repository at this point in the history
Closes GH-5.

Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
Reviewed-by: Remco Haszing <remcohaszing@gmail.com>
Reviewed-by: Titus Wormer <tituswormer@gmail.com>
  • Loading branch information
Christian Ivicevic authored Nov 11, 2020
1 parent 3ce0ba0 commit 802eaab
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
"index.js",
"types/index.d.ts"
],
"dependencies": {
"github-slugger": "^1.1.1",
Expand All @@ -35,13 +36,15 @@
},
"devDependencies": {
"browserify": "^16.0.0",
"dtslint": "^4.0.0",
"nyc": "^15.0.0",
"prettier": "^2.0.0",
"rehype": "^11.0.0",
"remark-cli": "^8.0.0",
"remark-preset-wooorm": "^7.0.0",
"tape": "^5.0.0",
"tinyify": "^2.0.0",
"unified": "^9.0.0",
"xo": "^0.32.0"
},
"scripts": {
Expand All @@ -51,13 +54,17 @@
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
"test-types": "dtslint types",
"test": "npm run format && npm run build && npm run test-coverage && npm run test-types"
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
"branches": 100,
"ignores": [
"**/*.ts"
]
},
"prettier": {
"tabWidth": 2,
Expand Down
9 changes: 9 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Minimum TypeScript Version: 3.0
import {Plugin} from 'unified'

/**
* Add `id`s to headings.
*/
declare const slug: Plugin<[]>

export = slug
4 changes: 4 additions & 0 deletions types/rehype-slug-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import unified = require('unified')
import slug = require('rehype-slug')

unified().use(slug)
10 changes: 10 additions & 0 deletions types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"lib": ["es2015"],
"strict": true,
"baseUrl": ".",
"paths": {
"rehype-slug": ["index.d.ts"]
}
}
}
7 changes: 7 additions & 0 deletions types/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "dtslint/dtslint.json",
"rules": {
"semicolon": false,
"whitespace": false
}
}

0 comments on commit 802eaab

Please sign in to comment.