chore: Improved typehinting
This commit is contained in:
parent
8edc523af7
commit
5547cb5b87
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user