BreadB
Denoβ€’6mo ago
Bread

Deno LSP not narrowing types

I've got a project set up with vite and everything is working well but I'm getting the following error both in my editor and on build.

Is there some tsconfig setting that I'm missing that's preventing it from narrowing it to the correct type? This is my current config:

{
  "files": [],
  "compilerOptions": {
    "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
    "target": "ES2022",
    "useDefineForClassFields": true,
    "lib": ["ES2022", "DOM", "DOM.Iterable"],
    "module": "ESNext",
    "skipLibCheck": true,

    /* Bundler mode */
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "verbatimModuleSyntax": true,
    "moduleDetection": "force",
    "noEmit": true,
    "jsx": "react-jsx",

    /* Linting */
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "erasableSyntaxOnly": true,
    "noFallthroughCasesInSwitch": true,
    "noUncheckedSideEffectImports": true
  },
  "imports": {
    "react": "npm:react"
  },
}
Screenshot_2025-07-11_at_10.46.39_AM.png
Was this page helpful?