## 事象 [[Vite]]で[[Vue]]と[[TypeScript]]のプロジェクトを作成した。 ```console bun create vite@latest bruno-report-viewer --template vue-ts ``` `tsconfig.json` に [[vueCompilerOptions.strictTemplates]] を追加したが、[[Neovim]]を開いてもエラーが表示されず、設定が有効になっていなそう。 `tsconfig.json` ```json { "files": [], "references": [ { "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" } ], "compilerOptions": { "baseUrl": ".", "paths": { "@/*": ["./src/*"] } }, "vueCompilerOptions": { "strictTemplates": true } } ``` ### 環境 | 対象 | バージョン | | ---------------- | ------ | | [[macOS]] | 15.7.2 | | [[Bun]] | 1.3.2 | | [[Vue]] | 3.5.24 | | [[Vite]] | 7.2.5 | | [[TypeScript]] | 5.9.3 | ## 原因 `tsconfig.json` の [[references (tsconfig)|references]] に記載されたプロジェクト([[tsconfig.json]])は、[[references (tsconfig)|references]]の元となっている `tsconfig.json` の設定を継承するわけではないから。 `tsconfig.json` の [[references (tsconfig)|references]] はプロジェクトの参照関係を示しているだけ。 ## 解決方法 `tsconfig.app.json` に追加する。 ```json { "extends": "@vue/tsconfig/tsconfig.dom.json", "compilerOptions": { "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", "types": ["vite/client"], "baseUrl": ".", "paths": { "@/*": ["./src/*"] }, /* Linting */ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, "erasableSyntaxOnly": true, "noFallthroughCasesInSwitch": true, "noUncheckedSideEffectImports": true }, "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"], // ★追加 "vueCompilerOptions": { "strictTemplates": true } } ``` > [!info] > `tsconfig.json` の `compilerOptions` は継承されなくても必要。消すと[[shadcn-vue]]のコンポーネント追加コマンドが失敗する。 ## 関連 - [[📝Nuxtのtsconfig.jsonでvueCompilerOptions.strictTemplatesをtrueに設定しても期待通り動かない]]