Skip to content

webshrine / stdtyp/src / SerializableToString

Interface: SerializableToString

Defines a type that can be serialised to a string via the toString method or implicit type conversion

See

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString

Example

ts
class SomeObject implements SerializableToString {
  toString = () => 'SomeObject[...]'
}

const str = new SomeObject() + '' // 'SomeObject[...]'

#interface #atom #serialisation

Properties

toString()

toString: () => string

Returns

string

Defined in

packages/stdtyp/src/interfaces/index.ts:21