I am currently working with a service file that contains the following:
export class MockDataService {
data:[] = [];
getAll(): Observable<any[]> { return of(this.data); }
}
To introduce a delay to my mocks, I decided to use a @pause()
decorator to wrap around all the functions:
export async function pause() {
await new Promise( res => setTimeout(res, 1500) );
}
In order to add a pause of 1.5 seconds to all endpoints, I applied it to the getAll()
function like so:
@pause()
getAll() {}
However, I encountered an error message when using it in my code. The error stated:
Unable to resolve signature of method decorator when called as an expression. Cannot invoke an expression whose type lacks a call signature. Type 'Promise<void>' has no compatible call signatures.
I am currently trying to understand why my function signatures might be incorrect. Additionally, I plan to use Http calls within these functions, so I believed I had the correct function definition.