-
-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added TypeScript types. #23
Conversation
The build is failing, but has nothing to do with the types. I can fix those issues in another PR if you want. |
Thanks for creating a TypeScript definition. 🙌 Can you follow this styleguide? |
index.d.ts
Outdated
@@ -0,0 +1,3 @@ | |||
declare const copyToClipboard: { (data: string): boolean; }; | |||
|
|||
export default copyToClipboard; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be simpler to just use export default function copyToClipboard ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's what I had initially. Will revert.
@@ -18,7 +18,7 @@ module.exports = input => { | |||
originalRange = selection.getRangeAt(0); | |||
} | |||
|
|||
document.body.appendChild(el); | |||
document.body.append(el); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed issue that failing the build. Not related to types addition.
@@ -28,7 +28,7 @@ module.exports = input => { | |||
let success = false; | |||
try { | |||
success = document.execCommand('copy'); | |||
} catch (err) {} | |||
} catch (error) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed issue that failing the build. Not related to types addition.
No rush @sindresorhus, but just wondering if there is anything else you'd like me to do for this PR. |
I went with #24 as it was more complete |
This adds TypeScript types. We'd need these for completing the transition to TypeScript for Refined GitHub, refined-github/refined-github#1783