I am struggling with a record
that is designed to only accept values of type number[]
or numbers
.
This is how it is structured:
type numberRecords = Record<string,number[]|number>;
I ran into an error when trying this:
export const myList:numberRecords = {
a: ["a",2]
}
However, I encountered no issues with the following code:
export default <numberRecords> {
a: ["a",2]
}
I can't understand why this happens. Should I use a named object or stick with an anonymous, default object? Personally, I would prefer the latter option...