Skip to content

Typescript: server side type inference on table level index or multi-column index not working #4510

@Se7enSe7enSe7en

Description

@Se7enSe7enSe7en

Context

I was trying to create and use a compound index based from the docs: https://spacetimedb.com/docs/tables/indexes#multi-column-queries but was stopped by a type error or type inference issue.

Steps to reproduce:

  1. run cli command spacetime init -t nuxt-ts to create a nuxt template project
  2. add a table level index in the person table
const spacetimedb = schema({
  person: table(
    {
      public: true,
      indexes: [
        { name: "test_idx", algorithm: "btree", columns: ["name"] },
        ...
       ]
   }
  1. use the index in a reducer
export const sayHello = spacetimedb.reducer((ctx) => {
  ctx.db.person.test_idx; // type error: Property 'test_idx' does not exist on type ... 
  ...
}

version: spacetime v2.0.2

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