https://www.boundaryml.com logo
Type mismatch for @stream.with_state
# help
w
Hey, is this a bug or a feature? Having issues with using the generated type because it's not fitting with the actual object.
Copy code
// BAML
class Update {
  plan string @stream.with_state
}

// BAML Interface
export interface Update {
  plan: string
}

// Actual object
update: {
  plan: {
    state: 'Complete',
    value: 'somevalue'
  }
}
s
Hey @wolfonchain, if you want the top level "update" key then you would have to wrap it in a new class i.e.
Copy code
// BAML
class Update {
  update Plan
}

class Plan {
  plan string @stream.with_state
}
Is that what you are trying to do?
v
oh another thing @wolfonchain is the type you import! If you are importing streaming types, you need to import them from "@/baml_client/stream_types" instead of "@/baml_client/types"
w
Thank you both. I think the issue is related to @Vaibhav (BAML 🐑) mentioned stream types. Though I can't see the file within the typescript generated client. https://cdn.discordapp.com/attachments/1403495308050169979/1404378520435691610/image.png?ex=689af8eb&is=6899a76b&hm=4d2707e0f503ed8b36bdc60553bcbd00ade979ce1d3df0372867cf9ae64e5235&
v
ah in this case its partial_types.ts. Once you upgrade to the latest version of baml, partial_types was renamed to stream_types
w
Thanks. Really enjoying BAML so far. Great job!