Skip to content

Commit

Permalink
🎨 typeguard faqtarget
Browse files Browse the repository at this point in the history
  • Loading branch information
HubM committed Nov 1, 2023
1 parent af2afcd commit f9ad34e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bdxio/bdxio.types",
"version": "1.3.3",
"version": "1.3.4",
"types": "dist/index.d.ts",
"files": [
"/dist"
Expand Down
Empty file added typeguards/index.ts
Empty file.
10 changes: 8 additions & 2 deletions types/Faq.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
export const FAQTargets = ["speakers", "sponsors", "participants"] as const;
export const faqTargets = ["speakers", "sponsors", "participants"] as const;

type FAQTargets = (typeof faqTargets)[number]

export function isFAQTarget(value: any): value is FAQTargets {
return faqTargets.includes(value);
}

export type FAQTarget = {
id: number;
target: (typeof FAQTargets)[number];
target: (typeof faqTargets)[number];
description?: string;
createdAt: string;
publishedAt: string;
Expand Down
2 changes: 1 addition & 1 deletion types/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export type { Category } from "./Category";
export type { Edition } from "./Edition";
export type { FAQQuestion, FAQTarget } from "./Faq";
export { FAQTargets } from "./Faq";
export { faqTargets, isFAQTarget } from "./Faq";
export type { Format } from "./Format";
export type { Media } from "./Media";
export type { Offer } from "./Offer";
Expand Down

0 comments on commit f9ad34e

Please sign in to comment.