Skip to content

Commit 79a7d51

Browse files
committed
It works.
1 parent a39d3f9 commit 79a7d51

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

browser-extension/tests/playground/replicaData.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export interface RedditSpot extends CommentSpot {
99
type: 'REDDIT'
1010
}
1111

12+
const withSpot = <T extends CommentSpot>(spot: T): T => spot
13+
1214
export const generateMockDrafts = (): CommentTableRow[] => [
1315
{
1416
isOpenTab: true,
@@ -35,14 +37,14 @@ export const generateMockDrafts = (): CommentTableRow[] => [
3537
},
3638
time: Date.now() - 1000 * 60 * 30,
3739
},
38-
spot: {
40+
spot: withSpot({
3941
domain: 'github.com',
4042
number: 1234,
4143
slug: 'microsoft/vscode',
4244
title: "Fix memory leak in extension host (why is this so hard! It's been months!)",
4345
type: 'GH_PR_ADD_COMMENT',
4446
unique_key: '1',
45-
} satisfies GitHubPRAddCommentSpot,
47+
} satisfies GitHubPRAddCommentSpot),
4648
},
4749
{
4850
isOpenTab: false,
@@ -64,12 +66,12 @@ export const generateMockDrafts = (): CommentTableRow[] => [
6466
},
6567
time: Date.now() - 1000 * 60 * 60 * 2,
6668
},
67-
spot: {
69+
spot: withSpot({
6870
subreddit: 'programming',
6971
title: "Re: What's your favorite VS Code extension?",
7072
type: 'REDDIT',
7173
unique_key: '2',
72-
} satisfies RedditSpot,
74+
} satisfies RedditSpot),
7375
},
7476
{
7577
isOpenTab: true,
@@ -86,14 +88,14 @@ export const generateMockDrafts = (): CommentTableRow[] => [
8688
},
8789
time: Date.now() - 1000 * 60 * 60 * 5,
8890
},
89-
spot: {
91+
spot: withSpot({
9092
domain: 'github.com',
9193
number: 5678,
9294
slug: 'facebook/react',
9395
title: 'Unexpected behavior with useEffect cleanup',
9496
type: 'GH_ISSUE_ADD_COMMENT',
9597
unique_key: '3',
96-
} satisfies GitHubIssueAddCommentSpot,
98+
} satisfies GitHubIssueAddCommentSpot),
9799
},
98100
{
99101
isOpenTab: false,
@@ -122,14 +124,14 @@ export const generateMockDrafts = (): CommentTableRow[] => [
122124
},
123125
time: Date.now() - 1000 * 60 * 60 * 24,
124126
},
125-
spot: {
127+
spot: withSpot({
126128
domain: 'github',
127129
number: 9012,
128130
slug: 'vercel/next.js',
129131
title: 'Update routing documentation',
130132
type: 'GH_PR_ADD_COMMENT',
131133
unique_key: '4',
132-
} satisfies GitHubPRAddCommentSpot,
134+
} satisfies GitHubPRAddCommentSpot),
133135
},
134136
{
135137
isOpenTab: true,
@@ -163,13 +165,13 @@ export const generateMockDrafts = (): CommentTableRow[] => [
163165
},
164166
time: Date.now() - 1000 * 60 * 60 * 48,
165167
},
166-
spot: {
168+
spot: withSpot({
167169
domain: 'github.com',
168170
number: 3456,
169171
slug: 'nodejs/node',
170172
title: 'Add support for ESM in worker threads',
171173
type: 'GH_PR_ADD_COMMENT',
172174
unique_key: '5',
173-
} satisfies GitHubPRAddCommentSpot,
175+
} satisfies GitHubPRAddCommentSpot),
174176
},
175177
]

0 commit comments

Comments
 (0)