Skip to content

Commit 8225d4c

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

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/es2015.core.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +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(searchString: string, endPosition?: number): boolean;
404+
endsWith<T extends string>(searchString: T, endPosition?: number): this is `${string}${T}`;
405405

406406
/**
407407
* Returns the String value result of normalizing the string into the normalization form
@@ -431,7 +431,7 @@ interface String {
431431
* same as the corresponding elements of this object (converted to a String) starting at
432432
* position. Otherwise returns false.
433433
*/
434-
startsWith(searchString: string, position?: number): boolean;
434+
startsWith<T extends string>(searchString: T, position?: number): this is `${T}${string}`;
435435

436436
/**
437437
* Returns an `<a>` HTML anchor element and sets the name attribute to the text value

0 commit comments

Comments
 (0)