vue-formulate icon indicating copy to clipboard operation
vue-formulate copied to clipboard

TypeScript support

Open OperKH opened this issue 4 years ago • 5 comments

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

OperKH avatar Jun 17 '20 08:06 OperKH

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?

justin-schroeder avatar Jun 17 '20 17:06 justin-schroeder

Unfortunately I don't have experience writing tests for TypeScript support.

OperKH avatar Jul 01 '20 06:07 OperKH

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).

justin-schroeder avatar Nov 23 '20 14:11 justin-schroeder

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

karachungen avatar Dec 24 '20 10:12 karachungen

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

IlCallo avatar Apr 16 '21 15:04 IlCallo