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

chore: Improved typehinting

This commit is contained in:
Zaytsev Kirill 2021-05-22 15:26:52 +03:00
parent 8edc523af7
commit 5547cb5b87

View File

@ -1,5 +1,8 @@
<template> <template>
<div class="formulario-input"> <div
v-bind="$attrs"
class="formulario-input"
>
<slot :context="context" /> <slot :context="context" />
</div> </div>
</template> </template>
@ -28,6 +31,15 @@ const VALIDATION_BEHAVIOR = {
SUBMIT: 'submit', SUBMIT: 'submit',
} }
type Context<U> = {
model: U;
name: string;
runValidation(): Promise<Violation[]>;
violations: Violation[];
errors: string[];
allErrors: string[];
}
interface ModelGetConverter { interface ModelGetConverter {
<U, T>(value: U|Empty): U|T|Empty; <U, T>(value: U|Empty): U|T|Empty;
} }
@ -99,7 +111,7 @@ export default class FormularioInput extends Vue {
} }
} }
get context (): Record<string, any> { get context (): Context<any> {
return Object.defineProperty({ return Object.defineProperty({
name: this.fullQualifiedName, name: this.fullQualifiedName,
runValidation: this.runValidation.bind(this), runValidation: this.runValidation.bind(this),