Skip to content

Commit

Permalink
fix type
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Sketon committed Dec 7, 2024
1 parent 032d7dc commit df75e29
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/compat/string/escapeRegExp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ describe('escapeRegExp', () => {
const values = [, null, undefined, ''];
const expected = map(values, stubString);

const actual = map(values, (value, index) =>
// @ts-expect-error - invalid escapeRegExp arguments
index ? escapeRegExp(value as any) : escapeRegExp()
);
const actual = map(values, (value, index) => (index ? escapeRegExp(value as any) : escapeRegExp()));

expect(actual).toEqual(expected);
});
Expand Down
2 changes: 1 addition & 1 deletion src/compat/string/escapeRegExp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ import { toString } from '../util/toString.ts';
*
* escapeRegExp('[es-toolkit](https://es-toolkit.slash.page/)'); // returns '\[es-toolkit\]\(https://es-toolkit\.slash\.page/\)'
*/
export function escapeRegExp(str: string): string {
export function escapeRegExp(str?: string): string {
return escapeRegExpToolkit(toString(str));
}

0 comments on commit df75e29

Please sign in to comment.