diff --git a/index.d.ts b/index.d.ts index cebc119..4d802b6 100644 --- a/index.d.ts +++ b/index.d.ts @@ -182,6 +182,7 @@ declare global { svgIconHash: string; svgIconPath: string; }; + const comments: { uiForPost(comments: JQuery): { addShow(value1: boolean, value2: boolean): void; @@ -193,6 +194,12 @@ declare global { ): void; }; }; + + const question: { + getQuestionId(): number; + canViewVoteCounts(): boolean; + scrollToPost(postId: number): boolean; + }; } } diff --git a/stackexchange.ts b/stackexchange.ts index 8f1910c..6cd937d 100644 --- a/stackexchange.ts +++ b/stackexchange.ts @@ -17,3 +17,15 @@ StackExchange.helpers.isInNetwork("stackoverflow.com"); // $ExpectError StackExchange.helpers.isInNetwork(); + +// $ExpectType number +StackExchange.question.getQuestionId(); + +// $ExpectType boolean +StackExchange.question.canViewVoteCounts(); + +// $ExpectError +StackExchange.question.scrollToPost(); + +// $ExpectType boolean +StackExchange.question.scrollToPost(123456);