Skip to content

Commit 19560ca

Browse files
authored
Merge pull request #24 from janczizikow/feature/ts-definitions
Add typescript definitions
2 parents 71cb898 + 7f071d3 commit 19560ca

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
"url": "https://github.com/disqus/disqus-react.git"
88
},
99
"main": "lib/index.js",
10+
"types": "types/index.d.ts",
1011
"files": [
1112
"dist",
12-
"lib"
13+
"lib",
14+
"types"
1315
],
1416
"scripts": {
1517
"test": "echo \"Error: no test specified\" && exit 1",

types/index.d.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import * as React from "react";
2+
3+
interface DisqusProps {
4+
shortname: string;
5+
config: {
6+
url: string;
7+
identifier: string;
8+
title: string;
9+
};
10+
}
11+
12+
interface CommentCountProps extends DisqusProps {
13+
children?: React.ReactNode;
14+
}
15+
16+
interface CommentEmbedProps {
17+
commentId: string;
18+
showParentComment?: boolean;
19+
showMedia?: boolean;
20+
width?: number;
21+
height?: number;
22+
}
23+
24+
interface IDisqus {
25+
CommentCount: React.Component<CommentCountProps, {}>;
26+
CommentEmbed: React.Component<CommentEmbedProps, {}>;
27+
DiscussionEmbed: React.Component<DisqusProps, {}>;
28+
}
29+
30+
declare class CommentCount extends React.Component<CommentCountProps, {}> {}
31+
declare class CommentEmbed extends React.Component<CommentEmbedProps, {}> {}
32+
declare class DiscussionEmbed extends React.Component<DisqusProps, {}> {}
33+
declare const Disqus: {
34+
CommentCount: React.ComponentType<CommentCountProps>;
35+
CommentEmbed: React.ComponentType<CommentEmbedProps>;
36+
DiscussionEmbed: React.ComponentType<DisqusProps>;
37+
};
38+
39+
export { CommentCount, CommentEmbed, DiscussionEmbed };
40+
export default Disqus;

0 commit comments

Comments
 (0)