dashman dashman - 11 months ago 84
TypeScript Question

Adding properties to an empty object

I have this code

var MY_OBJ = {};
MY_OBJ.test = function(){}


and I'm using Vscode, I get property test not defined.
How do I let this be just a warning.

Answer Source

This will fix your problem

var MY_OBJ:any = {};
MY_OBJ.test = function(){}