Skip to content

Commit

Permalink
feat: add type definitions;
Browse files Browse the repository at this point in the history
- Closes #10
  • Loading branch information
lukeed committed Jun 29, 2020
1 parent b4f43c0 commit 417e983
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions index.d.ts
@@ -0,0 +1,8 @@
declare module 'tinydate' {
type Defaults = 'YYYY' | 'YY' | 'MM' | 'DD' | 'HH' | 'mm' | 'ss' | 'fff';
export type Formatter = (date: Date) => string | number;
export type Dictionary = Record<Defaults | string, Formatter>;

function tinydate(template: string, dict?: Dictionary): (date?: Date) => string;
export = tinydate;
}
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -6,6 +6,7 @@
"unpkg": "dist/tinydate.min.js",
"module": "dist/tinydate.mjs",
"main": "dist/tinydate.js",
"types": "index.d.ts",
"license": "MIT",
"author": {
"name": "Luke Edwards",
Expand All @@ -23,7 +24,8 @@
"test": "tape test/*.js | tap-spec"
},
"files": [
"dist"
"dist",
"*.d.ts"
],
"keywords": [
"date",
Expand Down

0 comments on commit 417e983

Please sign in to comment.