Please tell me how to pull the hierarchy inside the associative array.
type Outside={
key: {
a: number;
b:string;
}
}
// I want to create an inside type from an outside type key (the outside type must not be changed)
// typeInside=typeofOutside.key // 'Outside' refers only to the type, but it is used as a value here. ts(2693)
const v —Inside=getOutsideValue().key;
You can access elements of type with []
.The feature appears to be called Indexed Access Types.
type Inside=Outside ["key"];
© 2024 OneMinuteCode. All rights reserved.