Comment

Comment by safety-third

No, it is very much LSP compliant. The purpose of toString() is to give a string representation of the object. Most overloads of this do exactly that.

An LSP violation of toString() would be something that returns a string that doesn't represent the object. If you were to return the current time as a string for an object that has nothing to do with time, that would be an LSP violation.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton