Tom
Tom

Reputation: 8701

Type 'ResponseContentType.ArrayBuffer' is not assignable to type '"json

I am currently upgrading my angular application to angular 7. Getting the following error. Just to let you know I am using httpclient. Not sure what the problem is.

Type 'ResponseContentType.ArrayBuffer' is not assignable to type '"json. The error is at the line responseType: ResponseContentType.ArrayBuffer

previewDocument(id: number) {
        //var pars = new URLSearchParams();
        let pars = new HttpParams();
        pars.set('id', id.toString());
        return this.http.get(this.config.api.previewDocument, { search: pars, withCredentials: true,  responseType: ResponseContentType.ArrayBuffer });
    }

Upvotes: 2

Views: 6956

Answers (1)

Fabian Küng
Fabian Küng

Reputation: 6193

ResponseContentType is deprecated. If you request non JSON data check the documentation for an example here.

The following types are available: 'arraybuffer' | 'blob' | 'json' | 'text'

I assume for your case you would use responseType: 'arraybuffer'.

Upvotes: 1

Related Questions