Skip to content

Commit

Permalink
fixed typing on quickpick
Browse files Browse the repository at this point in the history
  • Loading branch information
srzainab committed Nov 10, 2023
1 parent 3f0d867 commit e92c143
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
10 changes: 10 additions & 0 deletions src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export interface ReviewerSelectionItem extends QuickPickItem {
hasUser: boolean
xid: string
}
export interface SpaceUserSelectionItem extends QuickPickItem {
label: string
description: string
}
export enum CodeReviewType {
Pending,
Authored,
Expand All @@ -89,6 +93,7 @@ export enum ActivePullRequestActions {
ApplyLabel = 'Add label',
AddAssignee = 'Add assignee',
RequestReview = 'Add reviewer',
SetReminder = 'Set a reminder',
}
export type SpaceUser = {
id: string
Expand All @@ -112,6 +117,7 @@ export type ApiVariables =
| AddAssigneeVariables
| RequestReviewVariables
| CodeReviewApproveVariables
| CodeReviewRemindersVariables
export type ThreadMessageVariables = {
body: string
parentMessageXid: string
Expand Down Expand Up @@ -149,6 +155,10 @@ export type CodeReviewApproveVariables = {
codeReviewId: string
body?: string
}
export type CodeReviewRemindersVariables = {
codeReviewId: string
duration: number
}
export type RepoInfo = {
repoName?: string
branch?: string
Expand Down
8 changes: 4 additions & 4 deletions src/views/quickpicks/quickPick.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { QuickPickItem, window } from 'vscode'

export const QuickPick = {
create: ({
create: <Type extends QuickPickItem>({
items,
title,
placeholder,
onDidChangeSelection,
}: {
items: QuickPickItem[]
items: Type[]
title: string
placeholder: string
onDidChangeSelection: (selection: readonly QuickPickItem[]) => void
onDidChangeSelection: (selection: readonly Type[]) => void
}) => {
const quickPick = window.createQuickPick()
const quickPick = window.createQuickPick<Type>()
quickPick.items = items
quickPick.title = title
quickPick.placeholder = placeholder
Expand Down
6 changes: 4 additions & 2 deletions src/views/quickpicks/spaceUserPicker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ExtensionContext, window } from 'vscode'
import { Store } from '../../utils/store'
import { SpaceUser } from '../../utils'
import { SpaceUser, SpaceUserSelectionItem } from '../../utils'
import { QuickPick } from './quickPick'

export const spaceUserPicker = ({
Expand All @@ -12,7 +12,9 @@ export const spaceUserPicker = ({
context: ExtensionContext
placeholder: string
title: string
onDidChangeSelection: (item: any) => Promise<boolean>
onDidChangeSelection: (
item: readonly SpaceUserSelectionItem[]
) => Promise<boolean>
}) => {
const spaceUsers = Store.get(context)?.spaceUsers
if (!spaceUsers) {
Expand Down

0 comments on commit e92c143

Please sign in to comment.