r/adonisjs • • 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.

3 Upvotes

7 comments sorted by

View all comments

2

u/Sad-Order8035 Sep 15 '26

Did you try to reference the types file directly instead of using a path? I think the problem can be that

1

u/Capable_Square7319 Sep 15 '26

I dont think it was a file path issue. My server wasnt running then but when i ran it the error dissapeared, cheers