1

I have modelstate looking like this:

 var ModelState = {
    "model.StartDate": [ "The Start Date field is required." ],
    "model.EndDate": [ "The End Date field is required." ]
 }

I am then using this script to put this into an array:

var errors = [];
Object.keys(ModelState).forEach(function (key) {
   errors.push.apply(errors, ModelState[key]);
});

Can someone help me by telling me what the Typescript definition for errors would be. I realize it will be an array but how can I represent the contents?

1 Answers1

0

You can use custom JS errors to define an error or if you want to use some type from C# you can use this tool to transform C# types into TypeScript types.

Community
  • 1
  • 1
Remo H. Jansen
  • 23,172
  • 11
  • 70
  • 93