From 1eb46dc2c5f1c2ab139be309f29a70a5f2fc1bf6 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Sun, 20 Sep 2020 16:40:46 +0300 Subject: [PATCH] docs(material/paginator): add explicit type for better formatting in docs `MatPaginatorIntl.getRangeLabel` didn't have an explicit type which was causing dgeni to output the entire initializer. --- src/material/paginator/paginator-intl.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/material/paginator/paginator-intl.ts b/src/material/paginator/paginator-intl.ts index 9f793c986b36..68a4b9d2ce00 100644 --- a/src/material/paginator/paginator-intl.ts +++ b/src/material/paginator/paginator-intl.ts @@ -38,20 +38,21 @@ export class MatPaginatorIntl { lastPageLabel: string = 'Last page'; /** A label for the range of items within the current page and the length of the whole list. */ - getRangeLabel = (page: number, pageSize: number, length: number) => { - if (length == 0 || pageSize == 0) { return `0 of ${length}`; } + getRangeLabel: (page: number, pageSize: number, length: number) => string = + (page: number, pageSize: number, length: number) => { + if (length == 0 || pageSize == 0) { return `0 of ${length}`; } - length = Math.max(length, 0); + length = Math.max(length, 0); - const startIndex = page * pageSize; + const startIndex = page * pageSize; - // If the start index exceeds the list length, do not try and fix the end index to the end. - const endIndex = startIndex < length ? - Math.min(startIndex + pageSize, length) : - startIndex + pageSize; + // If the start index exceeds the list length, do not try and fix the end index to the end. + const endIndex = startIndex < length ? + Math.min(startIndex + pageSize, length) : + startIndex + pageSize; - return `${startIndex + 1} – ${endIndex} of ${length}`; - } + return `${startIndex + 1} – ${endIndex} of ${length}`; + } } /** @docs-private */