Skip to content

Commit

Permalink
Type Route#toString as /${string}.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdziuban committed Feb 3, 2025
1 parent d68e541 commit ee7c53f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/modules/route.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Added in v0.4.0
**Signature**

```ts
toString(encode: boolean = true): string
toString(encode: boolean = true): `/${string}`
```

Added in v0.4.0
4 changes: 2 additions & 2 deletions src/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ export class Route {
/**
* @since 0.4.0
*/
toString(encode: boolean = true): string {
toString(encode: boolean = true): `/${string}` {
const qs = fromQuery(this.query).toString()
const parts = encode ? this.parts.map(encodeURIComponent) : this.parts
return '/' + parts.join('/') + (qs ? '?' + qs : '')
return `/${parts.join('/')}${qs ? '?' + qs : ''}`
}
}

Expand Down

0 comments on commit ee7c53f

Please sign in to comment.