Skip to content

Commit

Permalink
fix: Expose ProjectViewStyle for requests
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelgrimm committed Oct 26, 2023
1 parent 8b1c471 commit 4bc1710
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/types/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ export const Project = Record({
}),
)

export type Project = Static<typeof Project>

// This allows us to accept any string during validation, but provide intellisense for the two possible values in request args
export type Project = Omit<Static<typeof Project>, 'viewStyle'> & { viewStyle: 'list' | 'board' }
export type ProjectViewStyle = 'list' | 'board'

export const Section = Record({
id: String,
Expand Down
6 changes: 3 additions & 3 deletions src/types/requests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RequireAllOrNone, RequireOneOrNone, RequireExactlyOne } from 'type-fest'
import type { Duration, Project } from './entities'
import type { Duration, ProjectViewStyle } from './entities'

export type AddTaskArgs = {
content: string
Expand Down Expand Up @@ -60,14 +60,14 @@ export type AddProjectArgs = {
parentId?: string
color?: string
isFavorite?: boolean
viewStyle?: Project['viewStyle']
viewStyle?: ProjectViewStyle
}

export type UpdateProjectArgs = {
name?: string
color?: string
isFavorite?: boolean
viewStyle?: Project['viewStyle']
viewStyle?: ProjectViewStyle
}

export type AddSectionArgs = {
Expand Down

0 comments on commit 4bc1710

Please sign in to comment.