Custom Type Declarations

I am trying to extend my @mui/material configuration and thus als its type declarations. When adding a declaration file mui.d.ts or mui.ts my local development works just fine (IDE Support and wasp start starts the server without problems) but when I try to deploy my app, the Typedefinition seems to get lost as i get the Error Property <MyAddedProperty> does not exist on Type XY. Any Idea how I can make this work?
7 Replies
kapa.ai
kapa.ai4mo ago
Hi @Gwaggli. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided in the knowledge sources, Wasp currently doesn't support custom TypeScript configuration. This means that you can't specify desired flags in your tsconfig.json files and merge it with Wasp's tsconfig.json files, which are the ones actually used when compiling. This limitation might be causing the issue you're experiencing when deploying your app. There's an open issue on GitHub discussing this feature request: Support custom TypeScript configuration (https://github.com/wasp-lang/wasp/issues/835). You might want to follow this issue for updates or contribute to the discussion. As a workaround, you might want to consider moving your custom type declarations to a part of your code that doesn't rely on Wasp's TypeScript configuration. However, this might not be feasible depending on your project's structure and requirements. Please note that this is a limitation of the current version of Wasp and might change in future versions. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Gwaggli, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Gwaggli
GwaggliOP4mo ago
Alright, I could workaround this by importing my mui.ts file in my root component and there force typescript to pick it up. I guess a cleaner solution is dependent on the issue Kapa mentioned?
miho
miho4mo ago
One for you @sodic - I guess importing with side effect makes sense in this scenario?
Filip
Filip4mo ago
Hey @Gwaggli, could you share a minimal example of this? I'd like to take a look and see what's happening
Gwaggli
GwaggliOP4mo ago
Yeah sure, i will setup an example soon! But probably it will be resolved with the custom tsconfig file that is planned for the next release, right?
Gwaggli
GwaggliOP4mo ago
@sodic https://github.com/Brakeable/wasp-custom-typings-example Here you go! Steps to reproduce: 1. wasp build 2. cd .wasp/build/web-app && npm run build This fails because of the missing typing while wasp start works just fine When you then uncomment the import import from 'mui' line in the MainPage.tsx file and retry the steps above, the build progresses further and spits out another error, but the missing typing error is gone. (sorry would need to investigate further what that other error means and how to fix it)
GitHub
GitHub - Brakeable/wasp-custom-typings-example
Contribute to Brakeable/wasp-custom-typings-example development by creating an account on GitHub.
Filip
Filip4mo ago
Ok, on it
Want results from more Discord servers?
Add your server