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