Skip to content
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

Closed
wants to merge 4 commits into from
Closed

Added TypeScript types. #23

wants to merge 4 commits into from

Conversation

nickytonline
Copy link

This adds TypeScript types. We'd need these for completing the transition to TypeScript for Refined GitHub, refined-github/refined-github#1783

@nickytonline
Copy link
Author

The build is failing, but has nothing to do with the types. I can fix those issues in another PR if you want.

@sindresorhus
Copy link
Owner

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;
Copy link
Owner

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 ...

Copy link
Author

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);
Copy link
Author

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) {}
Copy link
Author

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.

@nickytonline
Copy link
Author

No rush @sindresorhus, but just wondering if there is anything else you'd like me to do for this PR.

@sindresorhus
Copy link
Owner

I went with #24 as it was more complete

@nickytonline nickytonline deleted the typescript-types branch April 22, 2019 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants