next-type-safe-routes
next-type-safe-routes copied to clipboard
Bug: fails when `/api` isn't defined
I have a simple project with no API. When this plugin added I'm getting this error
no such file or directory, lstat '<project-path>/pages/api`
As a workaround – I've just created api/index.ts
seems like fixed long time ago but not released to NPM
Anyway, bug found in this "unreleased" version. When there is no /api
folder TypeSafeApiRoute
is not created but still referenced in typeSafeUrl
which causes TS to do not work.
it should be done like this
export type TypeSafeApiRoute = never;
or TypeSafeApiRoute
should not be mentioned at all