Skip to content

Tests with SvelteKit do not have types #1320

@marekdedic

Description

@marekdedic

Hi,
I'm trying to fix #1319 but it seems like I can't get proper SvelteKit types in the tests. I was trying this code:

<script lang="ts">
	import { type ResolvedPathname } from '$app/types';
	import { goto } from '$app/navigation';

	interface Props {
		href: ResolvedPathname;
	}

	const { href }: Props = $props();

	goto(href);
</script>

I found the node for the href parameter of the goto call (the Identifier node) and did this:

const tsNode = tsTools.service.esTreeNodeToTSNodeMap.get(node);
console.log(tsTools.service.program.getTypeChecker().getTypeAtLocation(tsNode));

and the resulting type has intrinsicName: "error". I think this is because we don't have SvelteKit in the tests, could we add that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions