ts-json-object icon indicating copy to clipboard operation
ts-json-object copied to clipboard

Wrong error message

Open jrm0695 opened this issue 4 years ago • 0 comments

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)

jrm0695 avatar Dec 04 '21 21:12 jrm0695