mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
fix(truncate-middle): null union type for str (#41277)
This fixes empty string return when param equals `null`: https://git.io/JeNkz Thanks!
This commit is contained in:
committed by
Ryan Cavanaugh
parent
d820013d4c
commit
35feaab6ae
2
types/truncate-middle/index.d.ts
vendored
2
types/truncate-middle/index.d.ts
vendored
@@ -3,6 +3,6 @@
|
||||
// Definitions by: Gary King <https://github.com/garyking>
|
||||
// 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;
|
||||
|
||||
@@ -7,3 +7,5 @@ truncateMiddle('text', 1);
|
||||
truncateMiddle('text', 1, 2);
|
||||
|
||||
truncateMiddle('text', 1, 2, '...');
|
||||
|
||||
truncateMiddle(null);
|
||||
|
||||
Reference in New Issue
Block a user