Can I define a fixed-length array property in Typescript?
For example:
//example code , not my actual case but similar
export type Car = {
doors:Door[]; //I want this to be exactly 4 doors
/// rest of code
}
I attempted the following:
export type Pattern = {
doors: Array<Door>[4];
////
};
However, this resulted in (property) doors: Door
instead of an array of four Door
objects.
Any suggestions on how to achieve this fixed-length array in Typescript?