2 months ago
Good evening, I'm uploading a react application with Vite and the build fails because of TypeScript typing warnings, which doesn't prevent the code from being executed locally. I've already used all the commands to ignore warnings at build time and it still didn't work. Can you help me?
Error example:
src/app/product/components/GeneralDefinitionProduct.tsx(155,74): error TS2322: Type 'Dispatch<SetStateAction<string>>' is not assignable to type '(value: string | number) => void'.
Types of parameters 'value' and 'value' are incompatible.
Type 'string | number' is not assignable to type 'SetStateAction<string>'.
Type 'number' is not assignable to type 'SetStateAction<string>'.
src/app/product/components/GeneralDefinitionProduct.tsx(160,72): error TS2322: Type 'Dispatch<SetStateAction<number>>' is not assignable to type '(value: string | number) => void'.
Types of parameters 'value' and 'value' are incompatible.
Type 'string | number' is not assignable to type 'SetStateAction<number>'.
Type 'string' is not assignable to type 'SetStateAction<number>'.
src/core/hooks/useUserHost.ts(5,44): error TS2345: Argument of type 'unknown' is not assignable to parameter of type '{ auth: AuthState; }'.
Property 'auth' is missing in type '{}' but required in type '{ auth: AuthState; }'.
src/core/hooks/useUserHost.ts(9,44): error TS2345: Argument of type 'unknown' is not assignable to parameter of type '{ auth: AuthState; }'.
5 Replies
Status changed to Awaiting User Response railway[bot] • about 2 months ago
2 months ago
Can you give me an example?
In which file do I add this variable? ts.config?
Status changed to Awaiting Railway Response railway[bot] • about 2 months ago
2 months ago
Set it in a service variable -
https://docs.railway.com/overview/the-basics#service-variables
Status changed to Awaiting User Response railway[bot] • about 2 months ago
2 months ago
Brody, my problem has nothing to do with environment variables. The problem is that Trypescript typing warnings are blocked in my build.
Set CI
to false
does not solve it
Status changed to Awaiting Railway Response railway[bot] • about 2 months ago
2 months ago
Yep, and Brody was suggesting that you get TS to be a bit less strict. You can also do stuff like: wrap the state setter in a function that ensures the value type matches.
All of the bugs you have listed aren't Railway specific but look like plain ol' TS type issues that will show only in a production build.
Status changed to Awaiting User Response railway[bot] • about 2 months ago
Status changed to Solved cesarsouza13 • about 2 months ago