8000 Fix TypeScript errors in ssr.ts & when using vue-tsc by TimKunze96 · Pull Request #87 · laravel/vue-starter-kit · GitHub
[go: up one dir, main page]

Skip to content

Fix TypeScript errors in ssr.ts & when using vue-tsc #87

New issue

Have a question about this project 8000 ? 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 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to 8000
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move module declaration into definition file, override PageProps and …
…add template macro types
  • Loading branch information
TimKunze96 committed Mar 17, 2025
commit 127797fc399079af6076b1405167e784a0052a59
13 changes: 0 additions & 13 deletions resources/js/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,6 @@ import { createApp, h } from 'vue';
import { ZiggyVue } from 'ziggy-js';
import { initializeTheme } from './composables/useAppearance';

// Extend ImportMeta interface for Vite...
declare module 'vite/client' {
interface ImportMetaEnv {
readonly VITE_APP_NAME: string;
[key: string]: string | boolean | undefined;
}

interface ImportMeta {
readonly env: ImportMetaEnv;
readonly glob: <T>(pattern: string) => Record<string, () => Promise<T>>;
}
}

const appName = import.meta.env.VITE_APP_NAME || 'Laravel';

createInertiaApp({
Expand Down
32 changes: 29 additions & 3 deletions resources/js/types/globals.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
import type { route as routeFn } from 'ziggy-js';
import { AppPageProps } from '@/types/index';
import { createHeadManager, Page, Router } from '@inertiajs/core';

declare global {
const route: typeof routeFn;
// Extend ImportMeta interface for Vite...
declare module 'vite/client' {
interface ImportMetaEnv {
readonly VITE_APP_NAME: string;

[key: string]: string | boolean | undefined;
}

interface ImportMeta {
readonly env: ImportMetaEnv;
readonly glob: <T>(pattern: string) => Record<string, () => Promise<T>>;
}
}

// Declare shared props for Inertia and App pages...
declare module '@inertiajs/core' {
interface PageProps extends InertiaPageProps, AppPageProps {}
}

// Add typings for Inertia's $page and $headManager properties...
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$inertia: typeof Router;
$page: Page;
$headManager: ReturnType<typeof createHeadManager>;
route: AppRouter;
}
}
0