type pictureType = {
portrait: string,
landscape: string
}
const picture: pictureType = {
portrait: require('./img/nc_ss19_620x960px_1.png'),
landscape: require('./img/960x576_1.png')
};
const [orientation, setOrientation] = useState('');
setOrientation('portrait') // Например
...
<Image source={picture[orientation]} />
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'pictureType'.
Как мне правильно описать тип? Пробовал разные способы.