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 types #4

Merged
merged 5 commits into from Aug 22, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
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
}
}