Skip to content

Commit

Permalink
Make cardType be a convenience warpper for types.
Browse files Browse the repository at this point in the history
Useful for #673. Part of #674.
  • Loading branch information
jkomoros committed Nov 14, 2023
1 parent 1ce3536 commit ee1b975
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export type CreateCardOpts = {
}

//duplicated in functions/src/type.ts
export const cardType = z.enum([
const cardTypeSchema = z.enum([
'content',
'section-head',
'working-notes',
Expand All @@ -80,7 +80,7 @@ export const cardType = z.enum([
'person'
]);

export type CardType = z.infer<typeof cardType>;
export type CardType = z.infer<typeof cardTypeSchema>;

type CSSPartString = string;

Expand Down Expand Up @@ -1402,6 +1402,7 @@ export type State = {
//will be used in a generic string context and want type-checking to verify it
//is part of the enum.
export const setName = (input : SetName) => setNameSchema.parse(input);
export const cardType = (input : CardType) => cardTypeSchema.parse(input);
export const referenceType = (input : ReferenceType) => referenceTypeSchema.parse(input);
export const editorTab = (input : EditorTab) => editorTabSchema.parse(input);
export const editorContentTab = (input : EditorContentTab) => editorContentTabSchema.parse(input);

0 comments on commit ee1b975

Please sign in to comment.