mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
docs: Fix accepted Provider type in doc snippet
out of the box my IDE tells me there an error on
const testProviders: Provider[] = [provideHttpClient(), provideHttpClientTesting()];
because `provideHttpClient()` returns an `EnvironmentProviders` so
I can't put it in a variable of type `Provider[]`
This commit is contained in:
parent
c49661b57b
commit
4e55ceafc9
1 changed files with 2 additions and 3 deletions
|
|
@ -53,11 +53,10 @@ The `setupFiles` and `providersFile` options are particularly useful for managin
|
|||
For example, you could create a `src/test-providers.ts` file to provide `provideHttpClientTesting` to all your tests:
|
||||
|
||||
```typescript {header: "src/test-providers.ts"}
|
||||
import {Provider} from '@angular/core';
|
||||
import {provideHttpClient} from '@angular/common/http';
|
||||
import {EnvironmentProviders, Provider} from '@angular/core';
|
||||
import {provideHttpClientTesting} from '@angular/common/http/testing';
|
||||
|
||||
const testProviders: Provider[] = [provideHttpClient(), provideHttpClientTesting()];
|
||||
const testProviders: (Provider | EnvironmentProviders)[] = [provideHttpClientTesting()];
|
||||
|
||||
export default testProviders;
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in a new issue