1
0
mirror of synced 2024-11-25 14:56:03 +03:00

Merge pull request #17 from cmath10/proposal-typehints

fix: Typehints for modelGetConverter / modelSetConverter
This commit is contained in:
Kruglov Kirill 2020-11-13 13:03:21 +03:00 committed by GitHub
commit d4ca4d80df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,6 +28,16 @@ const VALIDATION_BEHAVIOR = {
SUBMIT: 'submit',
}
interface ModelGetConverter {
<U, T>(value: U|Empty): U|T|Empty;
}
interface ModelSetConverter {
<T, U>(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: () => <U, T>(value: U|Empty): U|T|Empty => value }) modelGetConverter!: ModelGetConverter
@Prop({ default: () => <T, U>(value: U|T): U|T => value }) modelSetConverter!: ModelSetConverter
public proxy: any = this.getInitialValue()