I have the following code in my Vue component:
import Vue from 'vue';
import { ElForm } from 'element-ui/types/form';
type Validator = (
this: typeof PasswordReset,
rule: any,
value: any,
callback: (error?: Error) => void
) => void;
const validatePass1: Validator = (rule, value, callback) => {
if (value && this.form.passwordConfirm) {
(this.$refs.form as ElForm).validateField('passwordConfirm', valid => {});
}
};
// ...
const PasswordReset = Vue.extend({
// ...
This is not working as documented. I get a type error in the validatePass1 func:
'this' implicitly has type 'any' because it does not have a type annotation.
I don't understand why this isn't working.