Skip to content

Commit 8d5a896

Browse files
authored
Set generic on some InjectionToken. (angular#32753)
* refactor(material/sidenav): set generic for the `MAT_DRAWER_CONTAINER` token cleanup related to angular/angular/pull/47461 * refactor(material/chips): set generic for the `MAT_CHIP` token cleanup related to angular/angular/pull/47461 * refactor(material/slider): set generic for the `MAT_SLIDER` token cleanup related to angular/angular/pull/47461 * fixup! refactor(material/chips): set generic for the `MAT_CHIP` token * refactor(cdk/drag-drop): set generic for the `CDK_DROP_LIST_GROUP` token cleanup related to angular/angular/pull/47461
1 parent d3f9997 commit 8d5a896

File tree

8 files changed

+12
-10
lines changed

8 files changed

+12
-10
lines changed

goldens/cdk/drag-drop/index.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const CDK_DRAG_PREVIEW: InjectionToken<CdkDragPreview<any>>;
4141
export const CDK_DROP_LIST: InjectionToken<CdkDropList<any>>;
4242

4343
// @public
44-
export const CDK_DROP_LIST_GROUP: InjectionToken<CdkDropListGroup<unknown>>;
44+
export const CDK_DROP_LIST_GROUP: InjectionToken<CdkDropListGroup<CdkDropList<any>>>;
4545

4646
// @public
4747
export class CdkDrag<T = any> implements AfterViewInit, OnChanges, OnDestroy {

goldens/material/chips/index.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { QueryList } from '@angular/core';
3131
import { Subject } from 'rxjs';
3232

3333
// @public
34-
export const MAT_CHIP: InjectionToken<unknown>;
34+
export const MAT_CHIP: InjectionToken<MatChip>;
3535

3636
// @public
3737
export const MAT_CHIP_AVATAR: InjectionToken<unknown>;

src/cdk/drag-drop/directives/drop-list-group.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import {Directive, OnDestroy, Input, InjectionToken, booleanAttribute} from '@angular/core';
9+
import {Directive, InjectionToken, Input, OnDestroy, booleanAttribute} from '@angular/core';
10+
import type {CdkDropList} from './drop-list';
1011

1112
/**
1213
* Injection token that can be used to reference instances of `CdkDropListGroup`. It serves as
1314
* alternative token to the actual `CdkDropListGroup` class which could cause unnecessary
1415
* retention of the class and its directive metadata.
1516
*/
16-
export const CDK_DROP_LIST_GROUP = new InjectionToken<CdkDropListGroup<unknown>>(
17+
export const CDK_DROP_LIST_GROUP = new InjectionToken<CdkDropListGroup<CdkDropList>>(
1718
'CdkDropListGroup',
1819
);
1920

src/material/chips/chip-action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class MatChipContent {
4141
_handlePrimaryActionInteraction(): void;
4242
remove(): void;
4343
disabled: boolean;
44-
_edit(): void;
44+
_edit(event: Event): void;
4545
_isEditing?: boolean;
4646
}>(MAT_CHIP);
4747

src/material/chips/chip-icons.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ export class MatChipEdit extends MatChipAction {
7373
if (!this.disabled) {
7474
event.stopPropagation();
7575
event.preventDefault();
76-
this._parentChip._edit();
76+
this._parentChip._edit(event);
7777
}
7878
}
7979

8080
override _handleKeydown(event: KeyboardEvent) {
8181
if ((event.keyCode === ENTER || event.keyCode === SPACE) && !this.disabled) {
8282
event.stopPropagation();
8383
event.preventDefault();
84-
this._parentChip._edit();
84+
this._parentChip._edit(event);
8585
}
8686
}
8787
}

src/material/chips/tokens.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import {ENTER, ModifierKey} from '@angular/cdk/keycodes';
1010
import {InjectionToken} from '@angular/core';
11+
import type {MatChip} from './chip';
1112

1213
/** Key that can be used as a separator between chips. */
1314
export interface SeparatorKey {
@@ -69,4 +70,4 @@ export const MAT_CHIP_REMOVE = new InjectionToken('MatChipRemove');
6970
/**
7071
* Injection token used to avoid a circular dependency between the `MatChip` and `MatChipAction`.
7172
*/
72-
export const MAT_CHIP = new InjectionToken('MatChip');
73+
export const MAT_CHIP = new InjectionToken<MatChip>('MatChip');

src/material/sidenav/drawer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const MAT_DRAWER_DEFAULT_AUTOSIZE = new InjectionToken<boolean>(
7878
* Used to provide a drawer container to a drawer while avoiding circular references.
7979
* @docs-private
8080
*/
81-
export const MAT_DRAWER_CONTAINER = new InjectionToken('MAT_DRAWER_CONTAINER');
81+
export const MAT_DRAWER_CONTAINER = new InjectionToken<MatDrawerContainer>('MAT_DRAWER_CONTAINER');
8282

8383
@Component({
8484
selector: 'mat-drawer-content',

src/material/slider/slider-interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export enum _MatTickMark {
3030
* Used primarily to avoid circular imports.
3131
* @docs-private
3232
*/
33-
export const MAT_SLIDER = new InjectionToken<{}>('_MatSlider');
33+
export const MAT_SLIDER = new InjectionToken<_MatSlider>('_MatSlider');
3434

3535
/**
3636
* Injection token that can be used to query for a `MatSliderThumb`.

0 commit comments

Comments
 (0)