tsconfig: explicit 'types': ['bun'] for VS Code LSP

bun:test types live in 'bun-types', which is pulled in transitively by
@types/bun via a /// <reference types="bun-types" /> directive. bunx tsc
finds this via auto-discovery, but VS Code's TS Language Server doesn't
always honor auto-discovered @types/* packages under moduleResolution:
bundler, so it shows a phantom 'Cannot find module bun:test' error in
the editor.

Adding 'types': ['bun'] to compilerOptions makes the inclusion explicit
and matches what 'bun init' generates for new projects. tsc still
passes; the bun test suite still passes; the editor LSP now resolves
bun:test correctly.
This commit is contained in:
2026-06-17 21:15:41 -05:00
parent fec35a2333
commit add4a2d60c
+2 -1
View File
@@ -10,7 +10,8 @@
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"resolveJsonModule": true,
"noUncheckedIndexedAccess": true
"noUncheckedIndexedAccess": true,
"types": ["bun"]
},
"include": ["src/**/*.ts", "tests/**/*.ts"]
}