Closed hybridwebdev closed 7 months ago
If this is invalid TypeScript I would expect errors already when bundling the library itself, but that is not the case 🤔.
What version of TypeScript and Webpack are you using in your project? How can we reproduce this issue?
I am running webpack 5.75.0 and my project is using typescript ~4.5.5. As for a reproduction environment, your library is part of a very large and proprietary codebase I can't publish here. I can say I'm basically using your library very generically. Just importing type declarations and AJV to create an editor instance in VUE as per your demos. Standard stuff, and I highly doubt my implementation is the issue.
I see your library is using typescript 5.3.2 so it is a possibility that I need to update my version. Looking at the code to me it does look like the syntax in question is invalid. However, I could be wrong as my knowledge of typescript isn't as strong as it could be.
I will give updating my typescript a go and report back.
The weird issue is, this only occurs when building. In dev mode, I don't see any errors in VSC, console or anywhere.
Okay, so I updated my typescript to 4.9.5 (that was the highest I could go based on other dependencies in my library) and it resolved the issue. Seems my typescript version was indeed the culprit.
That's good news 🎉, thanks for letting me know!
As you can see in the image, webpack fails to build. It's caused by this code:
if you change it to this:
Then the build succeeds.
For clarification, I am using vanilla-jsoneditor in VUE 3 using webpack.