ts-json-object
ts-json-object copied to clipboard
Wrong error message
Consider this code :
class Test extends JSONObject {
@required
// @ts-ignore
public prop1: String
@required
@array(String)
// @ts-ignore
public prop2: Array<String>
}
try {
let test: Test = new Test({
"prop1": "hello",
"prop2": [5, 8]
})
}
catch(e) {
console.log("error " + e.toString())
}
I have the following error : Test.prop2 array element requires type 'number', got 'string' instead, while the error should be Test.prop2 array element requires type 'string', got 'string' number (confusing expected and actual array elements type)