This code does not work: for (let i = 0; i < (<any[]>(<any>res).Data).length; i++) { } if I'll refactor to this: let ln = (<any[]>(<any>res).Data).length; for (let i = 0; i < ln; i++) { } it works. is this intended?