funtypes
funtypes copied to clipboard
Objects created by the .parse method, do not have the toString method
const someSchema = FT.Record({...})
const parsedObject = someSchema.parse(...)
console.log(parsedObject.toString) // prints undefined
That's quite the unexpected behavior!
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.