-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Description
Given the following sveltekit file:
<script lang="ts">
import { page } from '$app/state';
import { resolve } from '$app/paths';
</script>
<a href={resolve('/[foo]/[bar]/[baz]', { ...(page.params as Required<typeof page.params>), baz: 2 })}>Go</a>and the following config:
/**
* @see https://prettier.io/docs/configuration
* @type {import("prettier").Config}
*/
export default {
singleQuote: true,
printWidth: 100,
plugins: ['prettier-plugin-svelte'],
overrides: [{ files: '*.svelte', options: { parser: 'svelte' } }],
};Prettier 3.7.3 and prettier-plugin-svelte 3.4.0 remove the generic passed to Required:
<script lang="ts">
import { page } from '$app/state';
import { resolve } from '$app/paths';
</script>
<a href={resolve('/[foo]/[bar]/[baz]', { ...(page.params as Required), baz: 2 })}>Go</a>The only work-around I've found for now is to declare the type in the script block:
<script lang="ts">
import { page } from '$app/state';
import { resolve } from '$app/paths';
type RequiredParameters = Required<typeof page.params>;
</script>
<a href={resolve('/[foo]/[bar]/[baz]', { ...(page.params as RequiredParameters), baz: 2 })}>Go</a>PretzelVector, iasthc, tomasz13nocon, mattlehrer, LucidityDesign and 21 moreCopilot
Metadata
Metadata
Assignees
Labels
No labels