Skip to content

Commit

Permalink
feat: Add TypeScript type definitions
Browse files Browse the repository at this point in the history
Also add @types/prettier as dependency.
  • Loading branch information
pastelmind authored and mjeanroy committed Sep 19, 2021
1 parent fa6afea commit 7b48524
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
28 changes: 28 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @file Type definition for rollup-plugin-prettier
*/

import type { Options as PrettierOptions } from "prettier";
import type { Plugin } from "rollup";

declare namespace prettier {
interface Options extends PrettierOptions {
/**
* Directory to look for a Prettier config file.
*
* If omitted, defaults to `process.cwd()`.
*/
cwd?: string;
/**
* Whether to generate a sourcemap.
*
* Note: This may take some time because rollup-plugin-prettier diffs the
* output to manually generate a sourcemap.
*/
sourcemap?: boolean;
}
}

declare function prettier(options?: prettier.Options): Plugin;

export = prettier;
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"type": "git",
"url": "git@github.com:mjeanroy/rollup-plugin-prettier.git"
},
"types": "./index.d.ts",
"scripts": {
"clean": "gulp clean",
"lint": "gulp lint",
Expand All @@ -31,6 +32,7 @@
"rollup": "^1.0.0 || ^2.0.0"
},
"dependencies": {
"@types/prettier": "^1.0.0 || ^2.0.0",
"diff": "5.0.0",
"lodash.hasin": "4.5.2",
"lodash.isempty": "4.4.0",
Expand Down

0 comments on commit 7b48524

Please sign in to comment.