Skip to content

Having issues with model with Dynamic Keys #1686

Answered by EmilTholin
alex-hladun asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @alex-hladun!

TypeScript cannot infer all the needed information automatically in this case, so you can use cast to cast the node snapshot to an instance type. You will then see that there is a slight error in the code; it's supposed to be openTime and closeTime:

self.storeArray.replace([
  cast({
    name: "McDonalds (Sarcee Beecon Hill)",
    address: "1994 Maynard Rd. Calgary, AB, T2E6J8",
    city: "Calgary",
    iconUrl: "https://i.imgur.com/bwtfoyu.png",
    coverUrl: "https://i.imgur.com/xPUF6zr.png",
    storeNumber: 1001,
    storeHours: {
      Monday: {
        open: true,
        times: [{ openTime: 900, closeTime: 1700 }]
      }
    }
  })
]);

There is also a tiny error i…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@alex-hladun
Comment options

@EmilTholin
Comment options

Answer selected by alex-hladun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants