Skip to content

Commit 806d553

Browse files
aktasumut34reinink
andauthored
Use Omit instead of Exclude in router types (#1857)
* change Exclude to Omit * Formatting --------- Co-authored-by: Jonathan Reinink <jonathan@reinink.ca>
1 parent c7b329c commit 806d553

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

packages/core/src/router.ts

+7-19
Original file line numberDiff line numberDiff line change
@@ -498,19 +498,15 @@ export class Router {
498498
}
499499
}
500500

501-
public get(
502-
url: URL | string,
503-
data: RequestPayload = {},
504-
options: Exclude<VisitOptions, 'method' | 'data'> = {},
505-
): void {
501+
public get(url: URL | string, data: RequestPayload = {}, options: Omit<VisitOptions, 'method' | 'data'> = {}): void {
506502
return this.visit(url, { ...options, method: 'get', data })
507503
}
508504

509-
public reload(options: Exclude<VisitOptions, 'preserveScroll' | 'preserveState'> = {}): void {
505+
public reload(options: Omit<VisitOptions, 'preserveScroll' | 'preserveState'> = {}): void {
510506
return this.visit(window.location.href, { ...options, preserveScroll: true, preserveState: true })
511507
}
512508

513-
public replace(url: URL | string, options: Exclude<VisitOptions, 'replace'> = {}): void {
509+
public replace(url: URL | string, options: Omit<VisitOptions, 'replace'> = {}): void {
514510
console.warn(
515511
`Inertia.replace() has been deprecated and will be removed in a future release. Please use Inertia.${
516512
options.method ?? 'get'
@@ -519,31 +515,23 @@ export class Router {
519515
return this.visit(url, { preserveState: true, ...options, replace: true })
520516
}
521517

522-
public post(
523-
url: URL | string,
524-
data: RequestPayload = {},
525-
options: Exclude<VisitOptions, 'method' | 'data'> = {},
526-
): void {
518+
public post(url: URL | string, data: RequestPayload = {}, options: Omit<VisitOptions, 'method' | 'data'> = {}): void {
527519
return this.visit(url, { preserveState: true, ...options, method: 'post', data })
528520
}
529521

530-
public put(
531-
url: URL | string,
532-
data: RequestPayload = {},
533-
options: Exclude<VisitOptions, 'method' | 'data'> = {},
534-
): void {
522+
public put(url: URL | string, data: RequestPayload = {}, options: Omit<VisitOptions, 'method' | 'data'> = {}): void {
535523
return this.visit(url, { preserveState: true, ...options, method: 'put', data })
536524
}
537525

538526
public patch(
539527
url: URL | string,
540528
data: RequestPayload = {},
541-
options: Exclude<VisitOptions, 'method' | 'data'> = {},
529+
options: Omit<VisitOptions, 'method' | 'data'> = {},
542530
): void {
543531
return this.visit(url, { preserveState: true, ...options, method: 'patch', data })
544532
}
545533

546-
public delete(url: URL | string, options: Exclude<VisitOptions, 'method'> = {}): void {
534+
public delete(url: URL | string, options: Omit<VisitOptions, 'method'> = {}): void {
547535
return this.visit(url, { preserveState: true, ...options, method: 'delete' })
548536
}
549537

0 commit comments

Comments
 (0)