Skip to content

Commit

Permalink
refactor: update type definitions for discussions and improve null ha…
Browse files Browse the repository at this point in the history
…ndling
  • Loading branch information
JeelRajodiya committed Dec 30, 2024
1 parent a220216 commit e974218
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions scripts/dashboard/build-dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ function getLabel(issue: GoodFirstIssues, filter: string) {
async function getDiscussions(
query: string,
pageSize: number,
endCursor = null
): Promise<Discussion['data']['search']['nodes']> {
endCursor: null | string = null
): Promise<Discussion['search']['nodes']> {
try {
const result: any = await graphql(query, {
const result: Discussion = await graphql(query, {
first: pageSize,
after: endCursor,
headers: {
Expand Down
10 changes: 4 additions & 6 deletions types/scripts/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface RateLimit {

interface PageInfo {
hasNextPage: boolean;
endCursor?: string;
endCursor: string | null;
}

interface Reactions {
Expand Down Expand Up @@ -138,11 +138,9 @@ export interface HotDiscussionsPullRequestsNode {
comments: Comments;
}
export interface Discussion {
data: {
search: {
pageInfo: PageInfo;
nodes: HotDiscussionsPullRequestsNode[] | HotDiscussionsIssuesNode[] | GoodFirstIssues[];
};
search: {
pageInfo: PageInfo;
nodes: HotDiscussionsPullRequestsNode[];
};
rateLimit: RateLimit;
}
Expand Down

0 comments on commit e974218

Please sign in to comment.