Skip to content

Commit

Permalink
refactor(#285): Add zod for KtLine
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianWendelborn committed Sep 21, 2021
1 parent 58e6085 commit 5963a46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 5 additions & 2 deletions packages/kotti-ui/source/kotti-line/KtLine.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
<script lang="ts">
import { defineComponent } from '@vue/composition-api'
import { propValidator } from '../props'
import { KottiLine } from './types'
export default defineComponent<KottiLine.InternalProps>({
export default defineComponent<KottiLine.PropsInternal>({
name: 'KtLine',
props: {
text: {
type: String,
default: null,
type: String,
validator: propValidator(KottiLine.propsInternalSchema, 'text'),
},
},
})
Expand Down
11 changes: 7 additions & 4 deletions packages/kotti-ui/source/kotti-line/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { z } from 'zod'

import { SpecifyRequiredProps } from '../types/utilities'

export namespace KottiLine {
export type InternalProps = {
text: string
}
export const propsInternalSchema = z.object({
text: z.string(),
})
export type PropsInternal = z.infer<typeof propsInternalSchema>

export type Props = SpecifyRequiredProps<InternalProps, never>
export type Props = SpecifyRequiredProps<PropsInternal, never>
}

0 comments on commit 5963a46

Please sign in to comment.