Skip to content

Commit

Permalink
Add TypeScript definition
Browse files Browse the repository at this point in the history
  • Loading branch information
nix6839 committed Mar 12, 2024
1 parent bc57478 commit 5d5823a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Check if a string is HTML.
*
* @param string The string to check if it is HTML.
* @returns `true` if the string is HTML, `false` otherwise.
*/
export default function isHtml(string: string): boolean;
4 changes: 4 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import {expectType} from 'tsd';
import isHtml from './index.js';

expectType<boolean>(isHtml('<!doctype html>'));
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"scripts": {
"test": "xo && ava"
"test": "xo && ava && tsd"
},
"files": [
"index.js"
"index.js",
"index.d.ts"
],
"keywords": [
"html",
Expand All @@ -35,6 +36,7 @@
},
"devDependencies": {
"ava": "^3.15.0",
"tsd": "^0.30.7",
"xo": "^0.44.0"
}
}

0 comments on commit 5d5823a

Please sign in to comment.