Skip to content

Commit

Permalink
Replace one last expect-error with an as
Browse files Browse the repository at this point in the history
In this case the 'as' is asserting "I know better than the compiler" and it
is both true and more accurate than saying "I expect typescript to error out
here." As an added benefit, `as` does more type checking than 'expect error',
so you get just a small bit more type safety.
  • Loading branch information
Crisfole committed Dec 16, 2023
1 parent 6cfd8b6 commit b5fc8bb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export const Router = <
RequestType = IRequest,
Args extends any[] = any[]
>({ base = '', routes = [] }: RouterOptions = {}): RouterType<RequestType, Args> =>
// @ts-expect-error TypeScript doesn't know that Proxy makes this work
({
__proto__: new Proxy({}, {
// @ts-expect-error (we're adding an expected prop "path" to the get)
Expand Down Expand Up @@ -97,4 +96,4 @@ export const Router = <
}
}
}
})
} as RouterType<RequestType, Args>)

0 comments on commit b5fc8bb

Please sign in to comment.