I installed Bun in WSL and connected to it via VS Code, but when I tried to use Bun.serve in my code, VS Code shows an error saying Cannot find name 'Bun'. I know this is because VS Code doesn't know that I'm using Bun, but I don't know how I can make VS Code recognize Bun.
I tried installing the official Bun VS Code extension, but the error persisted. I also searched on Google but I didn't find anything.
The error should stop showing and ideally VS Code should provide autocompletion for the Bun singleton.
have you try this one:
On TS you need to install bun-types as devDependency.
Command:
bun add -d bun-types
tsconfig.json file:
{
"compilerOptions": {
"types": [
"bun-types"
]
}
}
Follow this doc: https://bun.sh/docs/runtime/typescript
For those who are still encountering this issue, here is the updated fix
bun add -d @types/bun
{
"compilerOptions": {
"types": ["bun"],
//..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With