tsconfig.json 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. {
  2. "compilerOptions": {
  3. // Most non-library projects don't need to emit declarations.
  4. // So we add this option by default to make the config more friendly to most users.
  5. "noEmit": true,
  6. // When type-checking with solution-style tsconfigs, though with `noEmit: true`, there won't
  7. // be any `.d.ts` files emitted, but tsc still writes a `.tsbuildinfo` file to the `outDir`
  8. // for each project. If we don't explicitly set the `outDir`, it will be in the same folder
  9. // as the `tsconfig.json` file, which would look messy.
  10. // Setting it to `./dist/` isn't ideal either, because it would pollute the `dist` folder.
  11. // So we set it to a hidden folder in `node_modules` to avoid polluting the project root.
  12. // FIXME:
  13. // This caused a regression: https://github.com/vuejs/tsconfig/issues/27
  14. // Need to find a better solution.
  15. // "outDir": "./node_modules/.cache/vue-tsbuildinfo",
  16. // As long as you are using a build tool, we recommend you to author and ship in ES modules.
  17. // Even if you are targeting Node.js, because
  18. // - `CommonJS` is too outdated
  19. // - the ecosystem hasn't fully caught up with `Node16`/`NodeNext`
  20. // This recommendation includes environments like Vitest, Vite Config File, Vite SSR, etc.
  21. "module": "ESNext",
  22. // We expect users to use bundlers.
  23. // So here we enable some resolution features that are only available in bundlers.
  24. "moduleResolution": "bundler",
  25. "resolveJsonModule": true,
  26. // `allowImportingTsExtensions` can only be used when `noEmit` or `emitDeclarationOnly` is set.
  27. // But `noEmit` may cause problems with solution-style tsconfigs:
  28. // <https://github.com/microsoft/TypeScript/issues/49844>
  29. // And `emitDeclarationOnly` is not always wanted.
  30. // Considering it's not likely to be commonly used in Vue codebases, we don't enable it here.
  31. // Required in Vue projects
  32. "jsx": "preserve",
  33. "jsxImportSource": "vue",
  34. // `"noImplicitThis": true` is part of `strict`
  35. // Added again here in case some users decide to disable `strict`.
  36. // This enables stricter inference for data properties on `this`.
  37. "noImplicitThis": true,
  38. "strict": true,
  39. // <https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#verbatimmodulesyntax>
  40. // Any imports or exports without a type modifier are left around. This is important for `<script setup>`.
  41. // Anything that uses the type modifier is dropped entirely.
  42. "verbatimModuleSyntax": true,
  43. // A few notes:
  44. // - Vue 3 supports ES2016+
  45. // - For Vite, the actual compilation target is determined by the
  46. // `build.target` option in the Vite config.
  47. // So don't change the `target` field here. It has to be
  48. // at least `ES2020` for dynamic `import()`s and `import.meta` to work correctly.
  49. // - If you are not using Vite, feel free to overwrite the `target` field.
  50. "target": "ESNext",
  51. // For spec compilance.
  52. // `true` by default if the `target` is `ES2020` or higher.
  53. // Explicitly set it to `true` here in case some users want to overwrite the `target`.
  54. "useDefineForClassFields": true,
  55. // Recommended
  56. "esModuleInterop": true,
  57. "forceConsistentCasingInFileNames": true,
  58. // See <https://github.com/vuejs/vue-cli/pull/5688>
  59. "skipLibCheck": true,
  60. "paths": { "@/*": ["./*"] },
  61. "lib": ["ES2020", "DOM", "DOM.Iterable"],
  62. "types": [
  63. "unplugin-icons/types/vue",
  64. ]
  65. },
  66. }