Skip to content

Commit

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

Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
Reviewed-by: Jonathan Haines <jonno.haines@gmail.com>
Reviewed-by: Titus Wormer <tituswormer@gmail.com>
  • Loading branch information
pd4d10 committed Aug 22, 2020
1 parent a83d351 commit 020aa32
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1 deletion.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"types": "types/index.d.ts",
"files": [
"types/index.d.ts",
"index.js"
],
"dependencies": {},
"devDependencies": {
"dtslint": "^3.0.0",
"nyc": "^15.0.0",
"prettier": "^2.0.0",
"rehype-format": "^3.0.0",
Expand All @@ -49,7 +52,8 @@
"format": "remark . -qfo && prettier . --write && xo --fix",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test/index.js",
"test": "npm run format && npm run test-coverage"
"test-types": "dtslint types",
"test": "npm run format && npm run test-coverage && npm run test-types"
},
"nyc": {
"check-coverage": true,
Expand Down
20 changes: 20 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// TypeScript Version: 3.4

import {Plugin} from 'unified'

declare namespace remarkFootnotes {
type Footnotes = Plugin<[RemarkFootnotesOptions?]>

interface RemarkFootnotesOptions {
/**
* Whether to support `^[inline notes]`
*
* @defaultValue false
*/
inlineNotes?: boolean
}
}

declare const remarkFootnotes: remarkFootnotes.Footnotes

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

unified().use(footnotes)
unified().use(footnotes, {})
unified().use(footnotes, {inlineNotes: true})
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": {
"remark-footnotes": ["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 020aa32

Please sign in to comment.