Fix a number of Typescript issues (#31877)
Typescript error count is reduced from 633 to 540 with this. No runtime changes except in test code.
This commit is contained in:
parent
39d2fdefaf
commit
7207d93f01
16 changed files with 141 additions and 79 deletions
|
@ -1,12 +1,12 @@
|
|||
export function pathEscapeSegments(s) {
|
||||
export function pathEscapeSegments(s: string): string {
|
||||
return s.split('/').map(encodeURIComponent).join('/');
|
||||
}
|
||||
|
||||
function stripSlash(url) {
|
||||
function stripSlash(url: string): string {
|
||||
return url.endsWith('/') ? url.slice(0, -1) : url;
|
||||
}
|
||||
|
||||
export function isUrl(url) {
|
||||
export function isUrl(url: string): boolean {
|
||||
try {
|
||||
return stripSlash((new URL(url).href)).trim() === stripSlash(url).trim();
|
||||
} catch {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue