The toplainobject
function from the lodash library can be used in typescript with the help of the lodash typescript type definitions.
First, install the @types/lodash
package using npm:
index.ts37 chars2 lines
Then, import the toplainobject
function and use it in your code:
index.ts252 chars14 lines
In this example, toPlainObject
takes an object of type ExampleInterface
and returns a plain object with the same key-value pairs.
Note that the @types/lodash
package provides type definitions for the entire lodash library, so you can use other lodash functions in your typescript code with type safety.
gistlibby LogSnag