To use the propertyIsEnumerable
function from the Underscore library in TypeScript, you need to first import the library and the type definitions. You can do this by running the following command in your terminal:
48 chars2 lines
Once you have installed both the library and the type definitions, you can import the function and use it in your TypeScript code as shown below:
index.ts211 chars7 lines
In the above code, we import the entire Underscore library as _
, and then use the propertyIsEnumerable
function to check if the name
property is enumerable on the obj
object. We then check the toString
property to confirm that it is not enumerable. The output of the above code will be true
and false
, respectively.
gistlibby LogSnag