diff --git a/types/truncate-middle/index.d.ts b/types/truncate-middle/index.d.ts index ec4f3e52e7..9758d4435c 100644 --- a/types/truncate-middle/index.d.ts +++ b/types/truncate-middle/index.d.ts @@ -3,6 +3,6 @@ // Definitions by: Gary King // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function truncateMiddle(text: string, frontLength?: number, backLength?: number, ellipsis?: string): string; +declare function truncateMiddle(text: string | null, frontLength?: number, backLength?: number, ellipsis?: string): string; export = truncateMiddle; diff --git a/types/truncate-middle/truncate-middle-tests.ts b/types/truncate-middle/truncate-middle-tests.ts index 9bb60ee7d1..eb1b28a776 100644 --- a/types/truncate-middle/truncate-middle-tests.ts +++ b/types/truncate-middle/truncate-middle-tests.ts @@ -7,3 +7,5 @@ truncateMiddle('text', 1); truncateMiddle('text', 1, 2); truncateMiddle('text', 1, 2, '...'); + +truncateMiddle(null);