ForbesLindesay / funtypes

Runtime validation for static types
MIT License
29 stars 4 forks source link

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

Open caeus opened 1 year ago

caeus commented 1 year ago

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

const parsedObject = someSchema.parse(...)

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

That's quite the unexpected behavior!

ForbesLindesay commented 10 months ago

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.