Skip to content

Commit 515d00d

Browse files
committed
Add generic type parameter to startsWith/endsWith
1 parent 0f3d0e0 commit 515d00d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/lib/es2015.core.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ interface String {
401401
* same as the corresponding elements of this object (converted to a String) starting at
402402
* endPosition – length(this). Otherwise returns false.
403403
*/
404+
endsWith<T extends string>(searchString: T): this is `${string}${T}`;
404405
endsWith(searchString: string, endPosition?: number): boolean;
405406

406407
/**
@@ -431,6 +432,7 @@ interface String {
431432
* same as the corresponding elements of this object (converted to a String) starting at
432433
* position. Otherwise returns false.
433434
*/
435+
startsWith<T extends string>(searchString: T, position?: 0): this is `${T}${string}`;
434436
startsWith(searchString: string, position?: number): boolean;
435437

436438
/**

0 commit comments

Comments
 (0)