1
0
mirror of synced 2024-11-22 05:16:05 +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>
<div class="formulario-input">
<div
v-bind="$attrs"
class="formulario-input"
>
<slot :context="context" />
</div>
</template>
@ -28,6 +31,15 @@ const VALIDATION_BEHAVIOR = {
SUBMIT: 'submit',
}
type Context<U> = {
model: U;
name: string;
runValidation(): Promise<Violation[]>;
violations: Violation[];
errors: string[];
allErrors: string[];
}
interface ModelGetConverter {
<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({
name: this.fullQualifiedName,
runValidation: this.runValidation.bind(this),