Cypress / TypeScript: How to update angular component variable in ‘then’

Helo to all,

I would like to wait, till ‘angComponent.gridApi’ haven’t the value ‘undefined’.

I’m not sure, but I think the variable ‘angComponent’ doesn’t updated.

cy.getAngularComponent(tableGrid).then((angComponent) => {
   cy.get(angComponent.gridApi).should('not.contain', undefined);
});