Tengo este constructor:
constructor(props: Props) { super(props); this.loggingService = new LoggingService(); this.state = { disableButton: this.reissueService.getReissueStatus(props.policy), showReissuePrompt: false }; } disableButton es disableButton: boolean .
Este es mi getReissueStatus :
async getReissueStatus(policy: string): Promise<boolean> { return await ApiService.getData(this.apiUrl + policy + this.myEndpoint).then( (response) => response.data ); } Tengo este error en disableButton en el constructor:
Type 'Promise<boolean>' is not assignable to type 'boolean'.ts(2322) Disclaimer.tsx(18, 4): The expected type comes from property 'disableButton' which is declared here on type 'Readonly<State>' Si Promise<boolean> y boolean no son compatibles y, además, el constructor no puede ser asíncrono, ¿cómo resuelvo esto para que disableButton se le asigne un valor booleano que devuelva la llamada a la API en getReissueStatus ?