I am looking to develop an Angular module that extends the Array object with a 'http' property of type 'HttpClient' from Angular.
To achieve this, I created a typings.d.ts file containing:
import {HttpClient} from '@angular/common/http';
interface Array<T> {
http: HttpClient;
}
I then added the following code snippet in the array.ts file (with undefined value for demonstration purposes):
Array.prototype.http = undefined;
However, when trying to access this property, I encountered the error:
'Property 'http' does not exist on type 'any[]''
Removing the import statement from my typings.d.ts file eliminated the initial error but introduced a new one specifically targeting the typings.d.ts file:
'Cannot find name 'HttpClient''
This issue may be attributed to my misunderstanding of how modules function in Typescript. For reference, I am utilizing TS version 2.3.4.