diff --git a/src/FormularioInput.vue b/src/FormularioInput.vue index ad70f1b..f9f9e06 100644 --- a/src/FormularioInput.vue +++ b/src/FormularioInput.vue @@ -28,6 +28,16 @@ const VALIDATION_BEHAVIOR = { SUBMIT: 'submit', } +interface ModelGetConverter { + (value: U|Empty): U|T|Empty; +} + +interface ModelSetConverter { + (curr: U|T, prev: U|Empty): U|T; +} + +type Empty = null | undefined + @Component({ name: 'FormularioInput', inheritAttrs: false }) export default class FormularioInput extends Vue { @Inject({ default: undefined }) formularioSetter!: Function|undefined @@ -57,8 +67,8 @@ export default class FormularioInput extends Vue { // Affects only observing & setting of local errors @Prop({ default: false }) errorsDisabled!: boolean - @Prop({ default: () => value => value }) modelGetConverter!: Function - @Prop({ default: () => value => value }) modelSetConverter!: Function + @Prop({ default: () => (value: U|Empty): U|T|Empty => value }) modelGetConverter!: ModelGetConverter + @Prop({ default: () => (value: U|T): U|T => value }) modelSetConverter!: ModelSetConverter public proxy: any = this.getInitialValue()