Skip to content

Shared props not typed properly #2930

@peaklabs-dev

Description

@peaklabs-dev

Inertia version

3.x (beta)

@inertiajs/svelte Version

2.3.1 and 3.0.0-beta.2

Backend stack (optional)

No response

Describe the problem

When using page to access a typed shared prop, it is any instead of the type specified.

<script lang="ts">
	import { page } from "@inertiajs/svelte";
</script>

<svelte:head>
	<title>Dashboard - {page.props.appName}</title> <!-- type is any instead of string -->
</svelte:head>

Steps to reproduce

Add this global.d.ts file:

declare module "@inertiajs/core" {
	export interface InertiaConfig {
		sharedPageProps: {
			appName: string;
		};
		errorValueType: string[];
	}
}

The tsconfig.json checks all .ts file via "include": ["resources/js/**/*.ts", "resources/js/**/*.svelte"], explicitly including .d.ts files did not fix the issue.

I am using bun as the package manager and installing @inertiajs/core did also not fix the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    svelteRelated to the svelte adapter

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions