Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions goldens/material/stepper/index.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ export class MatStep extends CdkStep implements ErrorStateMatcher, AfterContentI
}

// @public
export class MatStepContent {
export class MatStepContent<C = unknown> {
constructor(...args: unknown[]);
// (undocumented)
_template: TemplateRef<any>;
_template: TemplateRef<C>;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepContent, "ng-template[matStepContent]", never, {}, {}, never, never, true, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepContent<any>, "ng-template[matStepContent]", never, {}, {}, never, never, true, never>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepContent, never>;
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepContent<any>, never>;
}

// @public (undocumented)
Expand Down
2 changes: 1 addition & 1 deletion goldens/material/table/index.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export class MatTable<T> extends CdkTable<T> {
}

// @public
export class MatTableDataSource<T, P extends MatPaginator = MatPaginator> extends DataSource<T> {
export class MatTableDataSource<T extends object | ArrayLike<unknown>, P extends MatPaginator = MatPaginator> extends DataSource<T> {
constructor(initialData?: T[]);
connect(): BehaviorSubject<T[]>;
get data(): T[];
Expand Down
4 changes: 2 additions & 2 deletions goldens/material/timepicker/index.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ export class MatTimepickerInput<D> implements MatTimepickerConnectedInput<D>, Co
// (undocumented)
ngOnDestroy(): void;
readonly openOnClick: InputSignalWithTransform<boolean, unknown>;
registerOnChange(fn: (value: any) => void): void;
registerOnChange(fn: (value: unknown) => void): void;
registerOnTouched(fn: () => void): void;
registerOnValidatorChange(fn: () => void): void;
setDisabledState(isDisabled: boolean): void;
readonly timepicker: InputSignal<MatTimepicker<D>>;
timepickerValueAssigned(value: D | null): void;
validate(control: AbstractControl): ValidationErrors | null;
readonly value: ModelSignal<D | null>;
writeValue(value: any): void;
writeValue(value: unknown): void;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<MatTimepickerInput<any>, "input[matTimepicker]", ["matTimepickerInput"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "timepicker": { "alias": "matTimepicker"; "required": true; "isSignal": true; }; "min": { "alias": "matTimepickerMin"; "required": false; "isSignal": true; }; "max": { "alias": "matTimepickerMax"; "required": false; "isSignal": true; }; "openOnClick": { "alias": "matTimepickerOpenOnClick"; "required": false; "isSignal": true; }; "disabledInput": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
// (undocumented)
Expand Down
8 changes: 4 additions & 4 deletions goldens/material/tooltip/index.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class MatTooltip implements OnDestroy, AfterViewInit {
set hideDelay(value: NumberInput);
_isTooltipVisible(): boolean;
get message(): string;
set message(value: string | null | undefined);
set message(value: unknown);
// (undocumented)
ngAfterViewInit(): void;
ngOnDestroy(): void;
Expand All @@ -76,10 +76,10 @@ export class MatTooltip implements OnDestroy, AfterViewInit {
y: number;
}): void;
get tooltipClass(): string | string[] | Set<string> | {
[key: string]: any;
[key: string]: unknown;
};
set tooltipClass(value: string | string[] | Set<string> | {
[key: string]: any;
[key: string]: unknown;
});
// (undocumented)
_tooltipInstance: TooltipComponent | null;
Expand Down Expand Up @@ -143,7 +143,7 @@ export class TooltipComponent implements OnDestroy {
show(delay: number): void;
_tooltip: ElementRef<HTMLElement>;
tooltipClass: string | string[] | Set<string> | {
[key: string]: any;
[key: string]: unknown;
};
_triggerElement: HTMLElement;
// (undocumented)
Expand Down
4 changes: 2 additions & 2 deletions src/material/sort/sort.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,8 @@ class SimpleMatSortApp {
}
}

class FakeDataSource extends DataSource<any> {
connect(collectionViewer: CollectionViewer): Observable<any[]> {
class FakeDataSource extends DataSource<never> {
connect(collectionViewer: CollectionViewer): Observable<never[]> {
return collectionViewer.viewChange.pipe(map(() => []));
}
disconnect() {}
Expand Down
4 changes: 2 additions & 2 deletions src/material/stepper/step-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {Directive, TemplateRef, inject} from '@angular/core';
@Directive({
selector: 'ng-template[matStepContent]',
})
export class MatStepContent {
_template = inject<TemplateRef<any>>(TemplateRef);
export class MatStepContent<C = unknown> {
_template = inject<TemplateRef<C>>(TemplateRef);

constructor(...args: unknown[]);
constructor() {}
Expand Down
9 changes: 5 additions & 4 deletions src/material/table/table-data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ const MAX_SAFE_INTEGER = 9007199254740991;
* interactions. If your app needs to support more advanced use cases, consider implementing your
* own `DataSource`.
*/
export class MatTableDataSource<T, P extends MatPaginator = MatPaginator> extends DataSource<T> {
export class MatTableDataSource<
T extends object | ArrayLike<unknown>,
P extends MatPaginator = MatPaginator,
> extends DataSource<T> {
/** Stream that emits when a new data array is set on the data source. */
private readonly _data: BehaviorSubject<T[]>;

Expand Down Expand Up @@ -232,9 +235,7 @@ export class MatTableDataSource<T, P extends MatPaginator = MatPaginator> extend
// Transform the filter by converting it to lowercase and removing whitespace.
const transformedFilter = filter.trim().toLowerCase();
// Loops over the values in the array and returns true if any of them match the filter string
return Object.values(data as {[key: string]: any}).some(value =>
`${value}`.toLowerCase().includes(transformedFilter),
);
return Object.values(data).some(value => `${value}`.toLowerCase().includes(transformedFilter));
};

constructor(initialData: T[] = []) {
Expand Down
34 changes: 17 additions & 17 deletions src/material/table/table.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ describe('MatTable', () => {
const data = fixture.componentInstance.dataSource!.data;
expectTableToMatchContent(tableElement, [
['Column A', 'Column B', 'Column C'],
[data[0].a, data[0].b, data[0].c],
[data[1].a, data[1].b, data[1].c],
[data[2].a, data[2].b, data[2].c],
[data[0].a, data[0].b, data[0].c] as string[],
[data[1].a, data[1].b, data[1].c] as string[],
[data[2].a, data[2].b, data[2].c] as string[],
['fourth_row'],
['Footer A', 'Footer B', 'Footer C'],
]);
Expand Down Expand Up @@ -64,10 +64,10 @@ describe('MatTable', () => {
const data = fixture.componentInstance.dataSource!.data;
expectTableToMatchContent(tableElement, [
['Column A', 'Column B', 'Column C'],
[data[0].a, data[0].b, data[0].c],
[data[1].a, data[1].b, data[1].c],
[data[2].a, data[2].b, data[2].c],
[data[3].a, data[3].b, data[3].c],
[data[0].a, data[0].b, data[0].c] as string[],
[data[1].a, data[1].b, data[1].c] as string[],
[data[2].a, data[2].b, data[2].c] as string[],
[data[3].a, data[3].b, data[3].c] as string[],
]);
});

Expand Down Expand Up @@ -159,9 +159,9 @@ describe('MatTable', () => {
const data = fixture.componentInstance.dataSource!.data;
expectTableToMatchContent(tableElement, [
['Column A', 'Column B', 'Column C'],
[data[0].a, data[0].b, data[0].c],
[data[1].a, data[1].b, data[1].c],
[data[2].a, data[2].b, data[2].c],
[data[0].a, data[0].b, data[0].c] as string[],
[data[1].a, data[1].b, data[1].c] as string[],
[data[2].a, data[2].b, data[2].c] as string[],
]);
});

Expand All @@ -173,9 +173,9 @@ describe('MatTable', () => {
const data = fixture.componentInstance.dataSource!.data;
expectTableToMatchContent(tableElement, [
['Column A', 'Column B', 'Column C'],
[data[0].a, data[0].b, data[0].c],
[data[1].a, data[1].b, data[1].c],
[data[2].a, data[2].b, data[2].c],
[data[0].a, data[0].b, data[0].c] as string[],
[data[1].a, data[1].b, data[1].c] as string[],
[data[2].a, data[2].b, data[2].c] as string[],
]);
});

Expand Down Expand Up @@ -357,7 +357,7 @@ describe('MatTable', () => {
]);

// Change the filter to a falsy value that might come in from the view.
dataSource.filter = 0 as any;
dataSource.filter = 0 as unknown as string;
flushMicrotasks();
fixture.detectChanges();
expectTableToMatchContent(tableElement, [
Expand Down Expand Up @@ -604,7 +604,7 @@ describe('MatTable', () => {
['Footer A', 'Footer B', 'Footer C'],
]);

dataSource.data = {} as any;
dataSource.data = {} as TestData[];
fixture.changeDetectorRef.markForCheck();
fixture.detectChanges();
expectTableToMatchContent(tableElement, [
Expand Down Expand Up @@ -1108,7 +1108,7 @@ function getActualTableContent(tableElement: Element): string[][] {
return actualTableContent.map(row => row.map(cell => cell.textContent!.trim()));
}

export function expectTableToMatchContent(tableElement: Element, expected: any[]) {
export function expectTableToMatchContent(tableElement: Element, expected: string[][]) {
const missedExpectations: string[] = [];
function checkCellContent(actualCell: string, expectedCell: string) {
if (actualCell !== expectedCell) {
Expand All @@ -1134,7 +1134,7 @@ export function expectTableToMatchContent(tableElement: Element, expected: any[]
}

row.forEach((actualCell, cellIndex) => {
const expectedCell = expectedRow ? expectedRow[cellIndex] : null;
const expectedCell = expectedRow[cellIndex];
checkCellContent(actualCell, expectedCell);
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/material/timepicker/timepicker-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class MatTimepickerInput<D>
private _dateFormats = inject(MAT_DATE_FORMATS, {optional: true})!;
private _formField = inject(MAT_FORM_FIELD, {optional: true});

private _onChange: ((value: any) => void) | undefined;
private _onChange: ((value: unknown) => void) | undefined;
private _onTouched: (() => void) | undefined;
private _validatorOnChange: (() => void) | undefined;
private _cleanupClick: () => void;
Expand Down Expand Up @@ -195,7 +195,7 @@ export class MatTimepickerInput<D>
* Implemented as a part of `ControlValueAccessor`.
* @docs-private
*/
writeValue(value: any): void {
writeValue(value: unknown): void {
// Note that we need to deserialize here, rather than depend on the value change effect,
// because `getValidDateOrNull` will clobber the value if it's parseable, but not created by
// the current adapter (see #30140).
Expand All @@ -207,7 +207,7 @@ export class MatTimepickerInput<D>
* Implemented as a part of `ControlValueAccessor`.
* @docs-private
*/
registerOnChange(fn: (value: any) => void): void {
registerOnChange(fn: (value: unknown) => void): void {
this._onChange = fn;
}

Expand Down
26 changes: 13 additions & 13 deletions src/material/tooltip/tooltip.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,7 @@ describe('MatTooltip', () => {
fixture.detectChanges();

const styles = fixture.nativeElement.querySelector('button').style;
expect(styles.touchAction || (styles as any).webkitUserDrag).toBe('none');
expect(styles.touchAction || styles.webkitUserDrag).toBe('none');
});

it('should allow native touch interactions if touch gestures are turned off', () => {
Expand All @@ -1395,7 +1395,7 @@ describe('MatTooltip', () => {
fixture.detectChanges();

const styles = fixture.nativeElement.querySelector('button').style;
expect(styles.touchAction || (styles as any).webkitUserDrag).toBeFalsy();
expect(styles.touchAction || styles.webkitUserDrag).toBeFalsy();
});

it('should allow text selection on inputs when gestures are set to auto', () => {
Expand All @@ -1407,13 +1407,13 @@ describe('MatTooltip', () => {

expect(inputStyle.userSelect).toBeFalsy();
expect(inputStyle.webkitUserSelect).toBeFalsy();
expect((inputStyle as any).msUserSelect).toBeFalsy();
expect((inputStyle as any).MozUserSelect).toBeFalsy();
expect(inputStyle.msUserSelect).toBeFalsy();
expect(inputStyle.MozUserSelect).toBeFalsy();

expect(textareaStyle.userSelect).toBeFalsy();
expect(textareaStyle.webkitUserSelect).toBeFalsy();
expect((textareaStyle as any).msUserSelect).toBeFalsy();
expect((textareaStyle as any).MozUserSelect).toBeFalsy();
expect(textareaStyle.msUserSelect).toBeFalsy();
expect(textareaStyle.MozUserSelect).toBeFalsy();
});

it('should disable text selection on inputs when gestures are set to on', () => {
Expand All @@ -1425,14 +1425,14 @@ describe('MatTooltip', () => {
const inputUserSelect =
inputStyle.userSelect ||
inputStyle.webkitUserSelect ||
(inputStyle as any).msUserSelect ||
(inputStyle as any).MozUserSelect;
inputStyle.msUserSelect ||
inputStyle.MozUserSelect;
const textareaStyle = fixture.componentInstance.textarea.nativeElement.style;
const textareaUserSelect =
textareaStyle.userSelect ||
textareaStyle.webkitUserSelect ||
(textareaStyle as any).msUserSelect ||
(textareaStyle as any).MozUserSelect;
textareaStyle.msUserSelect ||
textareaStyle.MozUserSelect;

expect(inputUserSelect).toBe('none');
expect(textareaUserSelect).toBe('none');
Expand Down Expand Up @@ -1570,7 +1570,7 @@ describe('MatTooltip', () => {
})
class BasicTooltipDemo {
position: TooltipPosition = 'below';
message: any = initialTooltipMessage;
message: string | number = initialTooltipMessage;
showButton = true;
showTooltipClass = false;
tooltipDisabled = false;
Expand Down Expand Up @@ -1683,7 +1683,7 @@ class TooltipOnDraggableElement {
imports: [MatTooltip],
})
class TooltipDemoWithoutPositionBinding {
message: any = initialTooltipMessage;
message: string = initialTooltipMessage;
@ViewChild(MatTooltip) tooltip: MatTooltip;
@ViewChild('button') button: ElementRef<HTMLButtonElement>;
}
Expand All @@ -1705,7 +1705,7 @@ class TooltipDemoWithoutTooltipClassBinding {
imports: [MatTooltip],
})
class TooltipDemoWithTooltipClassBinding {
message: any = initialTooltipMessage;
message: string = initialTooltipMessage;
@ViewChild(MatTooltip) tooltip: MatTooltip;
@ViewChild('button') button: ElementRef<HTMLButtonElement>;
}
Expand Down
Loading
Loading