mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
dfe7be4d2a
The static `ɵprov` field emitted on `@Injectable()` classes uses `ɵɵInjectableDeclaration<T>`.
When a subclass extends a generic `@Injectable()` base class with contravariant parameters
(such as callback/transformer methods depending on generic type parameters), TypeScript's
static side inheritance check (`typeof Sub extends typeof Super`) fails with `TS2417` because
`ɵɵInjectableDeclaration<Sub>` is not assignable to `ɵɵInjectableDeclaration<Super<any>>`.
Using `any` (`o.DYNAMIC_TYPE`) in `createInjectableType` avoids strict variance checks on
static inheritance for internal Ivy definitions and aligns with other Ivy declaration types.
(cherry picked from commit caeab598c9)
156 lines
4.6 KiB
Markdown
156 lines
4.6 KiB
Markdown
## API Report File for "@angular/common_testing"
|
|
|
|
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
|
|
```ts
|
|
|
|
import * as i0 from '@angular/core';
|
|
import { InjectionToken } from '@angular/core';
|
|
import { Location as Location_2 } from '@angular/common';
|
|
import { LocationStrategy } from '@angular/common';
|
|
import { Provider } from '@angular/core';
|
|
import { SubscriptionLike } from 'rxjs';
|
|
|
|
// @public
|
|
export const MOCK_PLATFORM_LOCATION_CONFIG: InjectionToken<MockPlatformLocationConfig>;
|
|
|
|
// @public
|
|
export class MockLocationStrategy extends LocationStrategy {
|
|
constructor();
|
|
// (undocumented)
|
|
back(): void;
|
|
// (undocumented)
|
|
forward(): void;
|
|
// (undocumented)
|
|
getBaseHref(): string;
|
|
// (undocumented)
|
|
getState(): unknown;
|
|
// (undocumented)
|
|
internalBaseHref: string;
|
|
// (undocumented)
|
|
internalPath: string;
|
|
// (undocumented)
|
|
internalTitle: string;
|
|
// (undocumented)
|
|
onPopState(fn: (value: any) => void): void;
|
|
// (undocumented)
|
|
path(includeHash?: boolean): string;
|
|
// (undocumented)
|
|
prepareExternalUrl(internal: string): string;
|
|
// (undocumented)
|
|
pushState(ctx: any, title: string, path: string, query: string): void;
|
|
// (undocumented)
|
|
replaceState(ctx: any, title: string, path: string, query: string): void;
|
|
// (undocumented)
|
|
simulatePopState(url: string): void;
|
|
// (undocumented)
|
|
urlChanges: string[];
|
|
// (undocumented)
|
|
static ɵfac: i0.ɵɵFactoryDeclaration<MockLocationStrategy, never>;
|
|
// (undocumented)
|
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
}
|
|
|
|
// @public
|
|
export class MockPlatformLocation implements PlatformLocation {
|
|
constructor(config?: MockPlatformLocationConfig);
|
|
// (undocumented)
|
|
back(): void;
|
|
// (undocumented)
|
|
forward(): void;
|
|
// (undocumented)
|
|
getBaseHrefFromDOM(): string;
|
|
// (undocumented)
|
|
getState(): unknown;
|
|
// (undocumented)
|
|
get hash(): string;
|
|
// (undocumented)
|
|
historyGo(relativePosition?: number): void;
|
|
// (undocumented)
|
|
get hostname(): string;
|
|
// (undocumented)
|
|
get href(): string;
|
|
// (undocumented)
|
|
onHashChange(fn: LocationChangeListener): VoidFunction;
|
|
// (undocumented)
|
|
onPopState(fn: LocationChangeListener): VoidFunction;
|
|
// (undocumented)
|
|
get pathname(): string;
|
|
// (undocumented)
|
|
get port(): string;
|
|
// (undocumented)
|
|
get protocol(): string;
|
|
// (undocumented)
|
|
pushState(state: any, title: string, newUrl: string): void;
|
|
// (undocumented)
|
|
replaceState(state: any, title: string, newUrl: string): void;
|
|
// (undocumented)
|
|
get search(): string;
|
|
// (undocumented)
|
|
get state(): unknown;
|
|
// (undocumented)
|
|
get url(): string;
|
|
// (undocumented)
|
|
static ɵfac: i0.ɵɵFactoryDeclaration<MockPlatformLocation, [{ optional: true; }]>;
|
|
// (undocumented)
|
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
}
|
|
|
|
// @public
|
|
export interface MockPlatformLocationConfig {
|
|
// (undocumented)
|
|
appBaseHref?: string;
|
|
// (undocumented)
|
|
startUrl?: string;
|
|
}
|
|
|
|
// @public
|
|
export function provideLocationMocks(): Provider[];
|
|
|
|
// @public
|
|
export class SpyLocation implements Location_2 {
|
|
// (undocumented)
|
|
back(): void;
|
|
// (undocumented)
|
|
forward(): void;
|
|
// (undocumented)
|
|
getState(): unknown;
|
|
// (undocumented)
|
|
go(path: string, query?: string, state?: any): void;
|
|
// (undocumented)
|
|
historyGo(relativePosition?: number): void;
|
|
// (undocumented)
|
|
isCurrentPathEqualTo(path: string, query?: string): boolean;
|
|
ngOnDestroy(): void;
|
|
// (undocumented)
|
|
normalize(url: string): string;
|
|
// (undocumented)
|
|
onUrlChange(fn: (url: string, state: unknown) => void): VoidFunction;
|
|
// (undocumented)
|
|
path(): string;
|
|
// (undocumented)
|
|
prepareExternalUrl(url: string): string;
|
|
// (undocumented)
|
|
replaceState(path: string, query?: string, state?: any): void;
|
|
// (undocumented)
|
|
setBaseHref(url: string): void;
|
|
// (undocumented)
|
|
setInitialPath(url: string): void;
|
|
// (undocumented)
|
|
simulateHashChange(pathname: string): void;
|
|
// (undocumented)
|
|
simulateUrlPop(pathname: string): void;
|
|
// (undocumented)
|
|
subscribe(onNext: (value: any) => void, onThrow?: ((error: any) => void) | null, onReturn?: (() => void) | null): SubscriptionLike;
|
|
// (undocumented)
|
|
urlChanges: string[];
|
|
// (undocumented)
|
|
static ɵfac: i0.ɵɵFactoryDeclaration<SpyLocation, never>;
|
|
// (undocumented)
|
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
}
|
|
|
|
// (No @packageDocumentation comment for this package)
|
|
|
|
```
|