Closed svnty closed 9 months ago
This is strange, I've not seen this one before. And your code looks fine. What version of TS are you on? Ensure you're using the same version in VS Code and in the codebase. At the terminal you can run cat node_modules/typescript/package.json | grep version
and in VS code click on the curly braces near the word "TypeScript" in the status bar.
If you have a minimal reproducible example that I can run on my side, that would help.
Oh, also could you paste the contents of your tsconfig file?
According to this issue, it might be related to having "declaration emit enabled" in your config.
anonymous classes can't have private or protected members if declaration emit is enabled
"version": "5.3.3",
My source code is available here https://github.com/medicamina/api/tree/main
{
"compilerOptions": {
"lib": ["ESNext"],
"module": "esnext",
"target": "esnext",
"moduleResolution": "bundler",
"moduleDetection": "force",
"allowImportingTsExtensions": true,
"noEmit": true,
"composite": true,
"strict": true,
"downlevelIteration": true,
"skipLibCheck": true,
"jsx": "react-jsx",
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"allowJs": true,
"types": [
"bun-types" // add Bun global
]
}
}
What's strange is that the code compiles and runs without errors or warnings, it's just VS code complaining about types
I fixed it
The troublemaker
The new problem
VS Code's fix
Source code https://github.com/svnty/nbit/blob/main/packages/core/src/core/CustomRequest.ts
What am I doing wrong?