Skip to content

Document TypeScript issues in app.ts and tsconfig.json (VS Code warnings) #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions resources/js/app.ts
Original file line number Diff line number Diff line change
@@ -7,6 +7,10 @@ import { createApp, h } from 'vue';
import { ZiggyVue } from 'ziggy-js';
import { initializeTheme } from './composables/useAppearance';

// VS Code warning: "File 'vite/client.d.ts' is not a module" (TS2306)
// This import is still safe to use for type support in Vite projects.
// See related Vite issue: https://github.com/vitejs/vite/issues/5370

// Extend ImportMeta interface for Vite...
declare module 'vite/client' {
interface ImportMetaEnv {
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -39,11 +39,14 @@
},
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */

// "types": ["vue/tsx"] // Causes warning if '@vue/tsx-jsx' is not installed, which it appears is not installed by default
"types": [
"vite/client",
"vue/tsx",
"./resources/js/types"
] /* Specify type package names to be included without being referenced in a source file. */,

// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */