Merge pull request #17 from cmath10/proposal-typehints
fix: Typehints for modelGetConverter / modelSetConverter
This commit is contained in:
commit
d4ca4d80df
@ -28,6 +28,16 @@ const VALIDATION_BEHAVIOR = {
|
|||||||
SUBMIT: 'submit',
|
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 })
|
@Component({ name: 'FormularioInput', inheritAttrs: false })
|
||||||
export default class FormularioInput extends Vue {
|
export default class FormularioInput extends Vue {
|
||||||
@Inject({ default: undefined }) formularioSetter!: Function|undefined
|
@Inject({ default: undefined }) formularioSetter!: Function|undefined
|
||||||
@ -57,8 +67,8 @@ export default class FormularioInput extends Vue {
|
|||||||
// Affects only observing & setting of local errors
|
// Affects only observing & setting of local errors
|
||||||
@Prop({ default: false }) errorsDisabled!: boolean
|
@Prop({ default: false }) errorsDisabled!: boolean
|
||||||
|
|
||||||
@Prop({ default: () => value => value }) modelGetConverter!: Function
|
@Prop({ default: () => <U, T>(value: U|Empty): U|T|Empty => value }) modelGetConverter!: ModelGetConverter
|
||||||
@Prop({ default: () => value => value }) modelSetConverter!: Function
|
@Prop({ default: () => <T, U>(value: U|T): U|T => value }) modelSetConverter!: ModelSetConverter
|
||||||
|
|
||||||
public proxy: any = this.getInitialValue()
|
public proxy: any = this.getInitialValue()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user