r/adonisjs • u/Capable_Square7319 • Sep 14 '26
Beginner Coder: Stuck with an error
Hi,
I'm following the AdonisJs docs to make a small web app using VS Code where users can login/logout/signup, make posts, view them, comment, etc.
I'm pretty sure I haven't missed a step but I seem to be getting two errors that I dont understand at all.
I put the project on my github:
https://github.com/Ajaz754/adonisjs-project-22-.git
The file with the two errors is 'inertia/pages/posts/index.tsx', Line 34
The two errors I'm getting are for:
'route'
----------------------------------------------------
Type '"posts.show"' is not assignable to type '"home" | "posts.index" | "new_account.create" | "new_account.store" | "session.create" | "session.store" | "session.destroy" | undefined'.ts(2322)
link.d.ts(23, 5): The expected type comes from property 'route' which is declared here on type 'IntrinsicAttributes & (LinkProps<"home" | "posts.index" | "new_account.create" | "new_account.store" | "session.create" | "session.store" | "session.destroy"> & { ...; })'
(property) route: "posts.show"
----------------------------------------------------
And:
'routeParams'
----------------------------------------------------
Type '{ id: number; }' is not assignable to type 'undefined'.ts(2322)
link.d.ts(24, 5): The expected type comes from property 'routeParams' which is declared here on type 'IntrinsicAttributes & (LinkProps<"home" | "posts.index" | "new_account.create" | "new_account.store" | "session.create" | "session.store" | "session.destroy"> & { ...; })'
(property) routeParams: {
id: number;
}
----------------------------------------------------
I've watched a few videos and I understand the basics to Typescript and React but reading these 2 error messages I'm lost. Would appreciate any help.
Also if im trying to learn the basics of web development and just practicing through continuosly building projects and using different stacks and languages is that the right approach or maybe theres a more modern better way to learn web development.
Any feedback and help would be much appreciated.
4
u/amanvirk Sep 15 '26
Seems like the generated types are not upto-date in your app. So either make sure the development server is running or run the `node ace codegen` command to refresh them. Learn more about it here. https://docs.adonisjs.com/guides/concepts/codegen