Skip to content

Commit

Permalink
Merge pull request #18 from github/add-typescript-definition-file
Browse files Browse the repository at this point in the history
Add typescript definition file
  • Loading branch information
koddsson authored Aug 15, 2019
2 parents 99f91b7 + 3fe5fc9 commit f2902b3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default class ClipboardCopyElement extends HTMLElement {
value: string
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"repository": "github/clipboard-copy-element",
"main": "dist/index.umd.js",
"module": "dist/index.esm.js",
"types": "index.d.ts",
"scripts": {
"clean": "rm -rf dist",
"lint": "github-lint",
Expand All @@ -20,7 +21,8 @@
],
"license": "MIT",
"files": [
"dist"
"dist",
"index.d.ts"
],
"devDependencies": {
"@babel/core": "^7.5.5",
Expand Down
3 changes: 2 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export default {
},
{
file: pkg['main'],
format: 'umd'
format: 'umd',
name: 'ClipboardCopyElement'
}
],
plugins: [
Expand Down
2 changes: 1 addition & 1 deletion src/clipboard-copy-element.js.flow
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @flow strict */

declare class ClipboardCopyElement extends HTMLElement {
declare export default class ClipboardCopyElement extends HTMLElement {
get value(): string;
set value(value: string): void;
}
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import ClipboardCopyElement from './clipboard-copy-element'

export default ClipboardCopyElement

if (!window.customElements.get('clipboard-copy')) {
window.ClipboardCopyElement = ClipboardCopyElement
window.customElements.define('clipboard-copy', ClipboardCopyElement)
Expand Down

0 comments on commit f2902b3

Please sign in to comment.