Migration from 0.15 to 0.16 - Invalid value for the "compilerOptions.outDir" field in tsconfig.js

I was following the "Migration from 0.15 to 0.16" guide, which tells you to add this to tsconfig.js: { "compilerOptions": { // ... "composite": true, "skipLibCheck": true, "outDir": ".wasp/out/user" }, "include": [ "src" ] } so this is my resulting tsconfig.json: { "compilerOptions": { "composite": true, "skipLibCheck": true, "outDir": ".wasp/out/user", "module": "esnext", "target": "esnext", "moduleResolution": "bundler", "jsx": "preserve", "strict": true, "esModuleInterop": true, "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "typeRoots": [ "node_modules/@testing-library", "node_modules/@types" ], }, "include": [ "src" ] } but I get this error when compiling (after wasp clean): ❌ --- [Error] Your wasp project failed to compile: ------------------------------- - Invalid value for the "compilerOptions.outDir" field in tsconfig.json file, expected value: ".wasp/phantom". I can't see what I am missing? (Platform: WSL)
16 Replies
kapa.ai
kapa.ai2w ago
Hi @Red_Demon. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I apologize, but the knowledge sources provided do not contain specific information about migrating from Wasp version 0.15 to 0.16 or the exact error message you're encountering. The most recent migration guide mentioned in the sources is for migrating from 0.11.X to 0.12.X. However, based on the general context about Wasp's TypeScript configuration, I can provide some insights: 1. Wasp has been working on improving its TypeScript configuration story, as evidenced by several GitHub issues discussing tsconfig.json management (GitHub Issue #939, GitHub Issue #835). 2. There have been changes in how Wasp handles TypeScript configuration across different versions, which might explain why you're encountering this issue during migration. 3. The error message suggests that Wasp is expecting the outDir to be set to ".wasp/phantom" instead of ".wasp/out/user" as mentioned in your migration guide. Given this discrepancy and the lack of specific information about the 0.15 to 0.16 migration in the provided sources, I would recommend the following: 1. Double-check the official Wasp documentation for the most up-to-date migration guide, as the information you're working with might be outdated. 2. Try changing the outDir in your tsconfig.json to ".wasp/phantom" as suggested by the error message:
{
"compilerOptions": {
// ...
"outDir": ".wasp/phantom",
// ...
},
// ...
}
{
"compilerOptions": {
// ...
"outDir": ".wasp/phantom",
// ...
},
// ...
}
3. If the issue persists, it would be best to reach out to the Wasp community or maintainers directly, as this seems to be a specific problem that might require more context about the latest changes in Wasp 0.16. Lastly, since you mentioned you're using WSL, make sure your project is on the Linux file system to avoid potential issues, as suggested in this Discord support thread. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Red_Demon, 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?
A³Learn
A³Learn2w ago
hmm are you sure you have wasp 16 installed ?
miho
miho2w ago
Please run wasp version and report back 🙂
Red_Demon
Red_DemonOP2w ago
Sorry for wasting your time 🙂 What happened is that I tried to upgrade, I saw a bunch of errors, I rolled back and I continued implementing other stuff. Now I tried again and since I remembered I got errors I took for granted it was this one, without realizing I hadn't upgraded Wasp again. Anyways the actual errors I was getting were related to the openai libraries. I know this is not directly related to Wasp, but since OpenSaaS uses them, I wonder how you solve them there? @kapa.ai [ Wasp ] ../../../../node_modules/openai/src/_vendor/partial-json-parser/parser.ts(182,18): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'. [ Wasp ] ../../../../node_modules/openai/src/core.ts(1181,11): error TS18047: 'modifiedArg' is possibly 'null'. [ Wasp ] ../../../../node_modules/openai/src/internal/qs/utils.ts(10,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'. [ Wasp ] ../../../../node_modules/openai/src/internal/qs/utils.ts(179,9): error TS2322: Type 'any' is not assignable to type 'never'. [ Wasp ] ../../../../node_modules/openai/src/internal/qs/utils.ts(189,9): error TS2322: Type 'number' is not assignable to type 'never'. [ Wasp ] ../../../../node_modules/openai/src/internal/qs/utils.ts(194,9): error TS2322: Type 'number' is not assignable to type 'never'. [ Wasp ] ../../../../node_modules/openai/src/internal/qs/utils.ts(202,7): error TS2322: Type 'number' is not assignable to type 'never'. [ Wasp ] ../../../../node_modules/openai/src/internal/qs/utils.ts(228,67): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'. [ Wasp ] ../../../../node_modules/openai/src/internal/qs/utils.ts(230,19): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'. [ Wasp ] ../../../../node_modules/openai/src/internal/qs/utils.ts(260,19): error TS2345: Argument of type 'T' is not assignable to parameter of type 'never'.
kapa.ai
kapa.ai2w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Thank you for providing more context about your situation. I understand that you're encountering TypeScript errors related to the OpenAI library while working with Wasp and OpenSaaS. While these errors are not directly related to Wasp itself, I can provide some insights based on how OpenSaaS handles OpenAI integration. The OpenSaaS template, which is built on Wasp, does indeed use the OpenAI library. Based on the information from the SaaS-Template-GPT repository, we can see that they use a specific version of the OpenAI library:
("openai", "^4.24.7"),
("openai", "^4.24.7"),
This suggests that OpenSaaS is using version 4.24.7 or higher of the OpenAI library. The errors you're seeing might be related to type incompatibilities between the OpenAI library and the TypeScript configuration in your project. To resolve these issues, you could try the following steps: 1. Ensure that you're using the same version of the OpenAI library as OpenSaaS. You can update your package.json to include:
"openai": "^4.24.7"

"openai": "^4.24.7"

2. Run npm install or yarn install to update your dependencies. 3. If you're still encountering TypeScript errors, you might need to adjust your TypeScript configuration. The OpenSaaS template likely has some specific TypeScript settings to accommodate these libraries. You could try adding the following to your tsconfig.json:
{
"compilerOptions": {
// ... other options ...
"skipLibCheck": true,
"noImplicitAny": false
}
}

{
"compilerOptions": {
// ... other options ...
"skipLibCheck": true,
"noImplicitAny": false
}
}

The skipLibCheck option can help bypass some of the strict type checking in external libraries, while noImplicitAny allows the use of implicit any types, which might resolve some of the type errors you're seeing. 4. If the errors persist, you might need to use type assertions in your code where you're using the OpenAI library. For example:
(openai as any).someMethod();

(openai as any).someMethod();

However, this should be used sparingly as it bypasses TypeScript's type checking. 5. Lastly, make sure you're using a compatible version of TypeScript. You can check the version used in the OpenSaaS template and align your project's TypeScript version with it. If these steps don't resolve the issues, you might want to reach out to the Wasp or OpenSaaS community directly, as they might have more specific solutions for these OpenAI library integration issues. Remember, while these suggestions are based on how OpenSaaS handles OpenAI integration, your specific project setup might require additional adjustments. Always ensure you understand the implications of any changes you make to your TypeScript configuration. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Red_Demon, 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?
Red_Demon
Red_DemonOP2w ago
I'm trying to use "openai": "^4.24.7" now, I'll report back. Thanks!
A³Learn
A³Learn2w ago
Hi the temporary solution is // @ts-nocheck on every page with an error Eventually you should not do that as it's not recommended practice. Essentially these errors come because you are assuming a type and Typescript wants you to be safe. Wasp requires strict:true so a hack would be // @ts-nocheck
Red_Demon
Red_DemonOP2w ago
Hi, What I don't understand is that the OpenSaaS template also uses the openai library and the same tsconfig.js as me, but I don't think @ts-nocheck is used anywhere, so how is it done there in order to not get those errors? I tried the same version of the openai library as the template, but same problem. @kapa.ai
kapa.ai
kapa.ai2w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- You raise an interesting point about the OpenSaaS template and its handling of the OpenAI library without apparent TypeScript errors. Let's explore this based on the information we have from the knowledge sources. The OpenSaaS template indeed uses the OpenAI library, as mentioned in the Discord support thread. However, the way it handles TypeScript compilation might be different from what you're experiencing. Here are a few insights that might explain why the template doesn't encounter these errors: 1. Vite and TypeScript: According to the Discord support thread on type checking, Wasp uses Vite for the client app, which by default doesn't perform type checking during development. As mentioned by a Wasp team member: "We are using Vite for the client app and their default config - without TSC -> that's why you don't see type errors for the client." 2. Server-side TypeScript: For the server code, Wasp uses TSC which watches files and recompiles them on changes. This is why you might see type errors for the server but not for the client. 3. Production Build: As mentioned in a GitHub issue about type checking, Wasp runs tsc for type checking before doing a production build. However, they're considering making this optional: "We should make it configurable if the type checks are ran when building for production." 4. Possible use of // @ts-ignore or // @ts-expect-error: While you mentioned that @ts-nocheck isn't used, it's possible that the template uses more targeted type-checking suppressions in specific areas where the OpenAI library is used. 5. Different TypeScript configuration: The template might have a slightly different TypeScript configuration that allows it to bypass these specific errors. Given this information, here are a few suggestions: 1. Check if you're running in development mode or trying to do a production build. The errors might only appear during production builds. 2. Look closely at how the OpenAI library is imported and used in the OpenSaaS template. There might be subtle differences in how it's implemented that avoid these type errors. 3. Compare your tsconfig.json with the one in the OpenSaaS template. There might be small differences that are causing these errors in your project but not in the template. 4. Consider reaching out to the Wasp community or the maintainers of the OpenSaaS template directly. They might have insights into how they're specifically handling these OpenAI library type issues that aren't immediately apparent from the code. Remember, the OpenSaaS template might have some custom configurations or workarounds that aren't immediately visible. If you're still unable to resolve these issues, it might be worth creating a minimal reproduction of the problem and sharing it with the Wasp community for more targeted assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Red_Demon, 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?
Vinny (@Wasp)
Vinny (@Wasp)2w ago
I think the bot gave you some outdated advice based on our old SaaS template (the one we had before Open SaaS) Open SaaS uses "openai": "^4.55.3" try running wasp clean and maybe also deleting your package-lock.json then wasp start again and see if you still get the error
Red_Demon
Red_DemonOP2w ago
Thanks Vinny, I also tried that. That's why I was saying that I don't understand how it is done in OpenSaaS 😦
MEE6
MEE62w ago
Wohooo @Red_Demon, you just became a Waspeteer level 1!
Vinny (@Wasp)
Vinny (@Wasp)2w ago
@Filip could you take a look at this issue when you get a chance?
Filip
Filip7d ago
Sorry @Red_Demon, I was loooking at the old problem I'll deal with the new one tomorrow morning Unless you've solved it by any chance?
Red_Demon
Red_DemonOP3d ago
I didn't solve it, no. No rush, thank you sodic. I merged the new version of the template with my app and I'm still getting the same (I don't see how this should affect, but hey)
Filip
Filip3d ago
Apologies @Red_Demon I was swamped with other stuff and this slipped my mind. I'll get to it tomorrow unless @miho figures out what's going on immediattely from the messages.

Did you find this page helpful?