As a fix, you could assign this to another variable, say self, and use that instead.
This should work:
public getTypes(vitalsModel) : Array<any>{
var vitals = _.get(vitalsModel, 'data');
if (_.isEmpty(vitals) || !_.isArray(vitals)) {
return [];
}
// assign the 'this' context to a variable
var self = this;
_.forEach(vitals, function (vital) {
let setting = _.get(vitalsModel, key);
// 'this' has a different context here
self.generalSettings.push(setting);
console.log(keys);
rows.push(keys);
loc++;
});
...
You could read this article to get a good understanding of how this works in JavaScript