#Types not correctly generated.
1 messages · Page 1 of 1 (latest)
did u try deleting .react-router/ folder ?
You should import like this : import type { Route } from './+types'
And have a file .react-router/types/app/routes/campaigns/+types/index.ts
Include ".react-router/types/**/*" in your tsconfig, and "rootDirs": [".", "./.react-router/types"],
I have the same problem. I used the template https://github.com/remix-run/react-router-templates/tree/main/cloudflare which works for deploying to Cloudflare Workers, but I do get the error.
@silk wadi did you manage to fix it using the solution proposed by @silk niche ?
Which route ?
I'm not sure to understand your question (i'm not a native english speaker) but solid (or svelte, don't remember) inspired react-router team for this. The rootDirsconfig allows multiple root directories to be treated as one merged directory. TypeScript will look for files in all specified directories as if they were one combined directory.
Current :
..prefix("/campaigns", [
index("./routes/campaigns/index.tsx"), // import type { Route } from './+types'
route(":campaignId", "./routes/campaigns/campaign/index.tsx"), // import type { Route } from './+types' because filename is still index.tsx
])
Maybe what you want is :
..prefix("/campaigns", [
index("./routes/campaigns/index.tsx"), // import type { Route } from './+types'
route(":campaignId", "./routes/campaigns/campaign.tsx"), // import type { Route } from './+types/campaign' because filename is campaign
])
Or (if you don't need the campaigns directory) :
..prefix("/campaigns", [
index("./routes/campaigns.tsx"), // import type { Route } from './+types/campaigns' because filename is campaigns
route(":campaignId", "./routes/campaigns.$id.tsx"), // import type { Route } from './+types/campaigns.$id' because filename is campaigns.$id
])