vue-formulate
vue-formulate copied to clipboard
TypeScript support
Here's a stub declaration to get started.
....
Originally posted by @kazazes in https://github.com/wearebraid/vue-formulate/issues/36#issuecomment-601833175
Also need to add this:
import Vue from 'vue';
declare module 'vue/types/vue' {
interface Vue {
$formulate: {
handle: (err: typeof Error, formName: string, skip?: boolean) => void | typeof Error;
reset: <V>(formName: string, initialValue?: V) => void;
resetValidation: (formName: string) => void;
setValues: <V>(formName: string, values: V) => void;
};
}
}
To be able call this methods from VUE instance
*Created new one because comments turned off in #36
Thanks @OperKH! Do you have any experience writing tests for TypeScript support? Is this the kind of thing you could propose in a PR with tests?
Unfortunately I don't have experience writing tests for TypeScript support.
This is now officially on the roadmap 🎉
The current plan is to re-write Vue Formulate for Vue 3 and with Typescript support for the next major release (3.0).
May be helpful to someone who use TS for vue-formulate now TS definitions for context and valdation error even payload: https://gist.github.com/karachungen/6465613aa8c04681e15d191854b90760
I took @karachungen types and refactored them to be used with a shim file: https://gist.github.com/IlCallo/cc9cacdec7d379c0fc9aa03dca14213c
Plugin options has not been written, as I ended up using this package after all, if someone wants to contribute I left a TODO there