You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
Fix more typescript --strict violations (#2795)
* Stash tsc fixes * Iterate * Iterate * Iterate * Fix tests * Iterate * Iterate * Iterate * Iterate * Add tests
This commit is contained in:
committed by
GitHub
parent
4b3e6939d6
commit
9f2f08dfd3
15
src/utils.ts
15
src/utils.ts
@@ -355,7 +355,9 @@ export function globToRegexp(glob: string, extended = false): string {
|
||||
const replacements: ([RegExp, string | ((substring: string, ...args: any[]) => string) ])[] = [
|
||||
[/\\\*/g, '.*'],
|
||||
[/\?/g, '.'],
|
||||
!extended && [
|
||||
];
|
||||
if (!extended) {
|
||||
replacements.push([
|
||||
/\\\[(!|)(.*)\\]/g,
|
||||
(_match: string, neg: string, pat: string) => [
|
||||
'[',
|
||||
@@ -363,8 +365,8 @@ export function globToRegexp(glob: string, extended = false): string {
|
||||
pat.replace(/\\-/, '-'),
|
||||
']',
|
||||
].join(''),
|
||||
],
|
||||
];
|
||||
]);
|
||||
}
|
||||
return replacements.reduce(
|
||||
// https://github.com/microsoft/TypeScript/issues/30134
|
||||
(pat, args) => args ? pat.replace(args[0], args[1] as any) : pat,
|
||||
@@ -372,8 +374,11 @@ export function globToRegexp(glob: string, extended = false): string {
|
||||
);
|
||||
}
|
||||
|
||||
export function ensureNoTrailingSlash(url: string): string {
|
||||
if (url && url.endsWith("/")) {
|
||||
export function ensureNoTrailingSlash(url: string): string;
|
||||
export function ensureNoTrailingSlash(url: undefined): undefined;
|
||||
export function ensureNoTrailingSlash(url?: string): string | undefined;
|
||||
export function ensureNoTrailingSlash(url?: string): string | undefined {
|
||||
if (url?.endsWith("/")) {
|
||||
return url.slice(0, -1);
|
||||
} else {
|
||||
return url;
|
||||
|
||||
Reference in New Issue
Block a user