diff --git a/README.md b/README.md index ffd68fe..cc6a606 100644 --- a/README.md +++ b/README.md @@ -62,3 +62,9 @@ This project has some automated tests, that will run using [nightwatch](nightwat npm i npm test ``` +# Typescript +This library has built-in Typescript definitions. + +``` +import * as copy from 'copy-to-clipboard'; +``` diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..4eb5070 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for copy-to-clipboard 3.0 +// Project: https://github.com/sudodoki/copy-to-clipboard +// Definitions by: Denis Carriere + +interface Options { + debug?: boolean; + message?: string; +} + +declare function copy(text: string, options?: Options): void; +declare namespace copy {} +export = copy; diff --git a/package.json b/package.json index 4c5e51f..4775824 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "3.0.6", "description": "Copy stuff into clipboard using JS with fallbacks", "main": "index.js", + "types": "index.d.ts", "scripts": { "pretest": "browserify ./index.js -o ./example/index.js --standalone copyToClipboard", "test": "nightwatch"