Async Custom Validator with API


Hi !
I’m trying to making my async custom validator but I can’t manage to dot it. I’ve been trying to implement the same as here :
So in my code I use authService wich is a custom API to check if the email user is already in the database. I return a JSON with the following form :

{existingUser: true}

Here is my TypeScript code :

let emailChecker = (control: FormControl) => {
            return authService.checkEmail(control.value).then(data => data.existingUser ? {'bidon': true} : {}); console.log("false"));

The problem is that data.existingUser is not known here because it comes from my API, so I’ve got the following error code

Property ‘existingUser’ does not exist on type ‘{}’.

The odd part is that I managed to make it work if ionic serve is running and that I first put data instead of data.existingUser and then putting back data.existingUser which does not generate any error .

My API method is the following :

exports.checkEmail = function(req, res, next){
    User.findOne({email:}, function(err, existingUser){
            return next(err);
            exist = true;
        return res.status(200).json({
            existingUser: exist

And here is my Provider methode :

        return new Promise((resolve, reject) => {
            let headers = new Headers();
            headers.append('Content-Type', 'application/json');            
            this.http.get('http://localhost:8080/api/auth/email', {headers: headers, search: {email: email}})
            .subscribe(res => {                
                let data = res.json();
            }, (err) => {

So I’m probably doing something wrong but after more hours than I can count and the same amount of research on the web, I’m hoping someone will help me with this one.