I'm struggling with my Vue component and encountering some errors.
<script lang="ts">
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 = function(rule, value, callback) {
if (value && this.form.passwordConfirm) {
(this.$refs.form as ElForm).validateField('passwordConfirm', valid => {});
}
};
const PasswordReset = Vue.extend({
// ...
The validatePass1
function is showing errors related to this.form
and this.$refs
:
"Property 'form' does not exist on type 'VueConstructor<{ form: { password: string; passwordConfirm: string; }; rules: { password: ({ requ...'."
"Property '$refs' does not exist on type 'VueConstructor<{ form: { password: string; passwordConfirm: string; }; rules: { password: ({ requ...'."
How can I make this function recognize the references, properties, or data attached to my component?