Expected validator to return Promise or Observable : <p>Im trying to do a custom validation on Angular 5 but I'm facing the following error</p>

<pre><code>Expected validator to return Promise or Observable
</code></pre>

<p>I just want to return an error to the form if the value doesnt match the required, heres my code:</p>

<p>This is the component where is my form</p>

<pre><code>  constructor(fb: FormBuilder, private cadastroService:CadastroService) {
    this.signUp = fb.group({
      "name": ["", Validators.compose([Validators.required, Validators.minLength(2)])],
      "email": ["", Validators.compose([Validators.required, Validators.email])],
      "phone": ["", Validators.compose([Validators.required, Validators.minLength(5)])],
      "cpf": ["", Validators.required, ValidateCpf]
    })     
   }
</code></pre>

<p>This code is in the file with the validation I want to implement:</p>

<pre><code>import { AbstractControl } from '@angular/forms';

export function ValidateCpf(control: AbstractControl){
    if (control.value == 13445) {
        return {errorCpf: true}
    }
    return null;
}
</code></pre>

<p>Can someone help me? Does that type of validation only work with observables or can I do i without being a promise or observable? thanks</p>
