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

[react-interval] Added typescript typings #131

Merged
merged 3 commits into from
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/interval/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/// <reference types="react" />
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file needs to be added to files section of package.json, otherwise it will not be included into a package.

To check that locally you can run yarn pack (or npm pack) inside folder and then check contents of resulting react-interval-*.tgz

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


declare module 'react-interval' {
type Props = {
callback: Function;
enabled?: boolean;
timeout?: number;
};

const ReactInterval: React.ComponentClass<Props>;

export = ReactInterval;
}
2 changes: 2 additions & 0 deletions packages/interval/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "2.0.2",
"description": "Safe React wrapper for setInterval",
"main": "lib/index.js",
"types": "index.d.ts",
"config": {
"component": "ReactInterval"
},
Expand Down Expand Up @@ -38,6 +39,7 @@
},
"homepage": "https://github.com/nkbt/react-works/tree/master/packages/interval",
"peerDependencies": {
"@types/react": "^15.0.0 || ^16.0.0",
"react": "^15.3.0 || ^16.0.0"
},
"dependencies": {
Expand Down