Error: Argument "data" is not a valid Document. Input is not a plain JavaScript object
In case some else bump into the same issue, the solution is to simple use Json to instantiate the object, like this:
var myDoc = {
Public: {
Name: "Jonh Doe"
}
} as MyDoc; //keep type to still get typescript compiler validations
I did something similar:
var myDoc = <MyDoc> {
Public: {
Name: "Jonh Doe"
}
}
It is semantically the same, I just think it is a bit cleaner.
I had same problem, in my case I'd forgot to add Content-Type:application/json
to my header when sending request, and then the object was treated as string and I got that error.