Skip to content

Commit

Permalink
refactor(cdk/a11y): explicitly add Provider type (#30393)
Browse files Browse the repository at this point in the history
add `Provider` type to `NOOP_TREE_KEY_MANAGER_FACTORY_PROVIDER` as the
inferred type throws error when running dev-app locally

(cherry picked from commit be74ffe)
  • Loading branch information
naaajii authored and crisbeto committed Jan 28, 2025
1 parent ad786f4 commit be49103
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/cdk/a11y/key-manager/noop-tree-key-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
TreeKeyManagerItem,
TreeKeyManagerStrategy,
} from './tree-key-manager-strategy';
import {Provider} from '@angular/core';

// NoopTreeKeyManager is a "noop" implementation of TreeKeyMangerStrategy. Methods are noops. Does
// not emit to streams.
Expand Down Expand Up @@ -102,7 +103,7 @@ export function NOOP_TREE_KEY_MANAGER_FACTORY<
*
* @breaking-change 21.0.0
*/
export const NOOP_TREE_KEY_MANAGER_FACTORY_PROVIDER = {
export const NOOP_TREE_KEY_MANAGER_FACTORY_PROVIDER: Provider = {
provide: TREE_KEY_MANAGER,
useFactory: NOOP_TREE_KEY_MANAGER_FACTORY,
};
6 changes: 2 additions & 4 deletions tools/public_api_guard/cdk/a11y.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { NgZone } from '@angular/core';
import { Observable } from 'rxjs';
import { OnChanges } from '@angular/core';
import { OnDestroy } from '@angular/core';
import { Provider } from '@angular/core';
import { QueryList } from '@angular/core';
import { Signal } from '@angular/core';
import { SimpleChanges } from '@angular/core';
Expand Down Expand Up @@ -430,10 +431,7 @@ export const MESSAGES_CONTAINER_ID = "cdk-describedby-message-container";
export function NOOP_TREE_KEY_MANAGER_FACTORY<T extends TreeKeyManagerItem>(): TreeKeyManagerFactory<T>;

// @public @deprecated
export const NOOP_TREE_KEY_MANAGER_FACTORY_PROVIDER: {
provide: InjectionToken<TreeKeyManagerFactory<any>>;
useFactory: typeof NOOP_TREE_KEY_MANAGER_FACTORY;
};
export const NOOP_TREE_KEY_MANAGER_FACTORY_PROVIDER: Provider;

// @public @deprecated
export class NoopTreeKeyManager<T extends TreeKeyManagerItem> implements TreeKeyManagerStrategy<T> {
Expand Down

0 comments on commit be49103

Please sign in to comment.