Wings
Wings

Reputation: 582

SvelteKit with typescript no intellisense inside html?

I have simple page component, but my intellisense isnide html is not working... Also after renameing property it doesn't rename inside html, it just breaks... Typescript version: 4.8.4 Here is my code:

<script lang="ts">
    import type { Blog } from "$lib/store/BlogStore";

    let blog: Blog = {
        id: 0,
        activeFrom: new Date(),
        isPublished: false,
        updatedAt: new Date(),
        content: {
            rows: [],
            notesHolder: []
        },
        previewImageUrl: '',
        tags: [],
        header: '',
        user: '',
        isPremium: false
    };
</script>

<div>
    {#each blog.<no intellisense here? as row}
        <div>
            <h1>{row.id}</h1>
            <p>{row.type}</p>
        </div>
    {/each}
</div>

here is my Blog interface:

export interface Blog {
    id: number;
    activeFrom: Date;
    isPublished: boolean;
    updatedAt: Date;
    content: BlogContent;
    previewImageUrl: string;
    tags: string[]; //tag
    header: string;
    user: string; // user
    isPremium: boolean;
}

Upvotes: 2

Views: 914

Answers (1)

Ziur Olpa
Ziur Olpa

Reputation: 2133

This seems to me more an issue of your IDE / extensions, rather than svelte/sveltekit itself.

You didn't specify what is you IDE and what extensions you have installed. But, in vscode with the recommended extensions (svelt for vs code) is indeed that example not working for me, but it seems to be a bug, because if you try:

{#if blog.tags}
p
{/if}

The autocompletion works, so intellisense clearly does work in the html. I wasn't able to find this as a reported issue in the repo, but I think this question may better be a github issue here. So feel free to raise the issue there if you also think is a bug at that end.

Upvotes: 1

Related Questions