Instanceof is a antipattern, if you need add new subtypes, requiere add other validation and you client is hight coupled with subtypes, if you change the subtypes class need change on client ( break Open Close)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I will implement the ReadonlyDocument.save() like this :
if instanceof(doc) is ReadonlyDocment :
throw an Error
else :
super().save()
Instanceof is a antipattern, if you need add new subtypes, requiere add other validation and you client is hight coupled with subtypes, if you change the subtypes class need change on client ( break Open Close)