Skip to content

Commit 22c7f18

Browse files
authored
Add types
Reviewed-by: Christian Murphy <[email protected]> Reviewed-by: Remco Haszing <[email protected]> Reviewed-by: Titus Wormer <[email protected]> Closes GH-29.
1 parent f2fed6a commit 22c7f18

File tree

5 files changed

+53
-1
lines changed

5 files changed

+53
-1
lines changed

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
"Titus Wormer <[email protected]> (https://wooorm.com)",
3333
"Anthony Maki <[email protected]>"
3434
],
35+
"types": "types/index.d.ts",
3536
"files": [
37+
"types/index.d.ts",
3638
"index.js"
3739
],
3840
"dependencies": {
@@ -42,6 +44,7 @@
4244
},
4345
"devDependencies": {
4446
"browserify": "^17.0.0",
47+
"dtslint": "^3.0.0",
4548
"nyc": "^15.0.0",
4649
"prettier": "^2.0.0",
4750
"remark": "^13.0.0",
@@ -50,6 +53,7 @@
5053
"remark-preset-wooorm": "^8.0.0",
5154
"tape": "^5.0.0",
5255
"tinyify": "^3.0.0",
56+
"unified": "^9.0.0",
5357
"xo": "^0.37.0"
5458
},
5559
"scripts": {
@@ -59,7 +63,8 @@
5963
"build": "npm run build-bundle && npm run build-mangle",
6064
"test-api": "node test",
6165
"test-coverage": "nyc --reporter lcov tape test/index.js",
62-
"test": "npm run format && npm run build && npm run test-coverage"
66+
"test-types": "dtslint types",
67+
"test": "npm run format && npm run build && npm run test-coverage && npm run test-types"
6368
},
6469
"nyc": {
6570
"check-coverage": true,

types/index.d.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// TypeScript Version: 3.4
2+
3+
import {Plugin} from 'unified'
4+
5+
declare namespace remarkGithub {
6+
type Github = Plugin<[RemarkGithubOptions?]>
7+
8+
interface RemarkGithubOptions {
9+
/**
10+
* Wrap mentions in `<strong>`, true by default.
11+
* @defaultValue true
12+
*/
13+
mentionStrong?: boolean
14+
15+
/**
16+
* Repository to link against.
17+
*/
18+
repository?: string
19+
}
20+
}
21+
22+
declare const remarkGithub: remarkGithub.Github
23+
24+
export = remarkGithub

types/remark-github-tests.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import unified = require('unified')
2+
import github = require('remark-github')
3+
4+
unified().use(github)
5+
unified().use(github, {})
6+
unified().use(github, {mentionStrong: false, repository: 'some/repo'})

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-github": ["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)