Skip to content

Commit fc7ba87

Browse files
crisbetoannieyw
authored andcommitted
docs(material/paginator): add explicit type for better formatting in docs (#20608)
`MatPaginatorIntl.getRangeLabel` didn't have an explicit type which was causing dgeni to output the entire initializer. (cherry picked from commit 2967ad0)
1 parent dc54b00 commit fc7ba87

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/material/paginator/paginator-intl.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,21 @@ export class MatPaginatorIntl {
3838
lastPageLabel: string = 'Last page';
3939

4040
/** A label for the range of items within the current page and the length of the whole list. */
41-
getRangeLabel = (page: number, pageSize: number, length: number) => {
42-
if (length == 0 || pageSize == 0) { return `0 of ${length}`; }
41+
getRangeLabel: (page: number, pageSize: number, length: number) => string =
42+
(page: number, pageSize: number, length: number) => {
43+
if (length == 0 || pageSize == 0) { return `0 of ${length}`; }
4344

44-
length = Math.max(length, 0);
45+
length = Math.max(length, 0);
4546

46-
const startIndex = page * pageSize;
47+
const startIndex = page * pageSize;
4748

48-
// If the start index exceeds the list length, do not try and fix the end index to the end.
49-
const endIndex = startIndex < length ?
50-
Math.min(startIndex + pageSize, length) :
51-
startIndex + pageSize;
49+
// If the start index exceeds the list length, do not try and fix the end index to the end.
50+
const endIndex = startIndex < length ?
51+
Math.min(startIndex + pageSize, length) :
52+
startIndex + pageSize;
5253

53-
return `${startIndex + 1}${endIndex} of ${length}`;
54-
}
54+
return `${startIndex + 1}${endIndex} of ${length}`;
55+
}
5556
}
5657

5758
/** @docs-private */

0 commit comments

Comments
 (0)