-
Hi there, I'm working on serializing { [key in bigint]?: Array<CoolType> } However, I would prefer to use number for the keys instead of bigint. I attempted to annotate the map directly with a custom type, but encountered an issue where CoolType is not imported correctly. Here's what I tried: #[derive(Debug, Clone, Serialize, TS)]
#[ts(export)]
pub struct AwesomeStruct {
#[ts(type = "{ [key in number]?: Array<CoolType> }")]
pub cool_types: HashMap<i64, Vec<CoolType>>,
} The problem with this approach is that What is the recommended way to annotate a type within a type? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey! |
Beta Was this translation helpful? Give feedback.
Hey!
I think
#[ts(as = "HashMap<i32, Vec<CoolType>>")]
should work.