client/components/domain/wishes/models.ts

24 lines
453 B
TypeScript
Raw Permalink Normal View History

2022-04-24 23:12:11 +02:00
import { result } from '../../common/result'
export type Wish = {
name: string
description?: string
link?: string
}
export const createWish = (
name: string,
description?: string,
link?: string
): result.Result<Wish, string> => {
if (typeof name !== 'undefined' && name.length > 0) {
return result.ok({
name,
description,
link,
} as Wish)
}
return result.err(`validation of wish failed via. createWish`)
}