I am using Typescript in my React-native project.Code working properly as per desired output.but getting typescript conflicts.
Sharing my code snippets
Importing json object from other config files.
import api from 'config/api.json'
languageSet = async (value: string) => { setStorageItem('language', value) this.setState({ setLoading: true }) const language = await getStorageItem('language'); if (language) { const baseURL = api[language][environment] ? api[language][environment].api : api[language].qa.api; } else { const baseURL = api.ch[environment] ? api.ch[environment].api : api.ch.qa.api; }}
I want to make dynamic baseURl that's why using language const to set it's value.
Following error I am facing.