1

How can I create my object with just the data present in the interface?

Ex: I have the following return from the api

"location": {
    "name": "example1",
    "region": "example2",
    "country": "Example",
    "lat": 0.00,
    "lon": 0.00,
    "tz_id": "example",
    "localtime": "2022-03-01 19:42"
}

And I only need the data present in my interface on the object

export interface Location {
  name: string
  region: string
  country: string
  localtime: string
}

0 Answers0