Typescript Performance - Strict Mode

just want to leave this here for others running into Performance issues when using Redwood in VSCode. (did not find comparable posts yet). Our codebase was pretty slow, with intellisense taking sometimes few seconds.
Using zod and having some bigger schema validation, we were checking, if zod was the issue. But the solution to faster typescript autocomplete and intellisense seems to be Strict Mode. Redwood supports it already, but does not turn it on by default. It is well documented though :slight_smile: TypeScript Strict Mode | RedwoodJS Docs

Related Zod issue:

Redwood is speedy now :)))


I’m struggling with importing cells, as they don’t have default exports, how did you handle those?

Seem to be the last thing I need for yarn rw type-check to be happy :confused:

Didn´t get there yet :confused:

1 Like

Thanks for getting back.

I think I can do

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import SurveyCell from 'src/components/SurveyCell/SurveyCell'

But that probably shouldn’t be the prefered solution :confused:

Maybe @danny and @Tobbe can help and know how to deal with this, since they worked on Strict Mode support in redwood v3 release?

does changing the import to

import SurveyCell from 'src/components/SurveyCell'

help at all?

If not, try running yarn rw g types - this is because Redwood’s special import syntax needs “mirror” definitions defined behind the scenes for you. Generated Types | RedwoodJS Docs

Usually most people develop with the dev server running, so its constantly generating these types for you.

1 Like

That seems to solve it yes.

On a side note, lol, I have been dreading cell imports for months, due to giving me red squigglies…

1 Like

I hear you. Definitely one of the weirder parts of Redwood, and something I wish I could solve.

VSCode doesn’t seem to understand how to use the mirror cells in it’s autosuggestions - but unfortunately we don’t really have enough time/people in the team to help with creating a language server plugin to help with these cases.

I’m curious where I got the idea from to import like that.

Looking at the docs Redwood Utility Types | RedwoodJS Docs seems to suggest to name files ***.cell.tsx, which isn’t what the generator does? So that’s confusing to me.

Yeah, that looks wrong. Do you want to write a PR to fix it?

I tried to get VSCode to auto-complete cell imports, but got stuck and ran out of time. Any help to get it working would be greatly appreciated

To be clear, you mean fix the docs?

Yes, exactly :slight_smile: The names are XyzCell.tsx (not Xyz.cell.tsx)

I think I ended up with this cause vscode can still suggest to import the story for the cell, so I probably just did that and removed the story ending.