funtypes icon indicating copy to clipboard operation
funtypes copied to clipboard

Objects created by the .parse method, do not have the toString method

Open caeus opened this issue 3 years ago • 1 comments


const someSchema = FT.Record({...})

const parsedObject = someSchema.parse(...)

console.log(parsedObject.toString) // prints undefined

That's quite the unexpected behavior!

caeus avatar Oct 18 '22 17:10 caeus

We generate objects with null as the prototype using Object.create(null) to prevent potential security vulnerabilities with prototype pollution. The lack of .toString is a side effect of this. I don' think it's a major issue given that the output of .toString would not be very useful anyway.

ForbesLindesay avatar Sep 29 '23 12:09 ForbesLindesay