btab0426B
Convex Community16mo ago
12 replies
btab0426

Schema Type Info Not Propagating In Svelte / VSCode

Couldn't find a similar post / issue so...

I have defined a schema like this...
import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";

export default defineSchema({
  instance_groups: defineTable({
    color: v.string(),
    name: v.string(),
    seq: v.int64(),
  }),
});

...and confirmed via the dashboard that this is the schema reflected on convex's server.

I noticed as I started using useQuery() in my svelteKit app that I wasn't getting field name completion on the returned documents.

My svelte route looks like this...
  import { useQuery } from "convex-svelte";
  import { api } from "../../convex/_generated/api";

  const query = useQuery(api.instance_groups.get, {});

...and it is definitely working in the sense that I can generate content on the page based on the reactive state of query (this is fantastic, BTW).

BUT, if I hover over api.instance_groups.get in VSCode, I see the type information shown in the attached screenshot.

Shouldn't that any be the actual type of the document as defined in the schema?

Or maybe I'm barking up the wrong tree. But something means that VSCode doesn't know the types of the returned documents.
image.png
Was this page helpful?