I'm facing an issue with my code - the `value.toISOString()` function was working fine until now, but suddenly it's throwing a compiler error. I recently upgraded from Angular 7 to 8, which also bumped up the Typescript version to 3.4.5. Any suggestions on what might be causing this problem?
import * as moment from 'moment';
...
private getQueryStringParameters(parameters: any) {
if (!parameters) {
return '';
}
let queryString = '?';
// tslint:disable-next-line:forin
for (const key in parameters) {
const value = parameters[key];
if (value !== undefined) {
if (value instanceof Array) {
value.forEach(
item =>
(queryString +=
key + '=' + encodeURIComponent('' + item) + '&')
);
} else if (value instanceof moment) {
queryString +=
key +
'=' +
encodeURIComponent('' + value.toISOString()) +
'&';
} else {
queryString +=
key + '=' + encodeURIComponent('' + value) + '&';
}
}
}
Appreciate any insights you could provide!