Within my Vue component, I am currently working with the following code:
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({
// ...
The issue arises as the functionality in the validatePass1
function is not behaving as expected. A type error occurs:
'this' implicitly has type 'any' because it does not have a type annotation.
It's puzzling why this error is occurring.