---
url: https://node-ts.github.io/bus/api/bus-messages/interfaces/MessageTypes.md
---
[API reference](../../index.md) / [@node-ts/bus-messages](../index.md) / MessageTypes

# Interface: MessageTypes

Defined in: [packages/bus-messages/src/message-types.ts:46](https://github.com/node-ts/bus/blob/2e6cf65c27833b707ae31ee623cfb6343770f434/packages/bus-messages/src/message-types.ts#L46)

The runtime types of messages and workflow state, generated from their TypeScript source by
`bus generate-message-types` in `@node-ts/bus-cli`. Pass the generated file's `messageTypes` to
`Bus.configure().withMessageTypes()`, so the bus restores Dates, Maps, Sets, BigInts and class
instances at any depth of the messages and workflow state it receives.

## Properties

| Property | Type | Description | Defined in |
| ------ | ------ | ------ | ------ |
| <a id="property-messages"></a> `messages` | `object` | Maps the `$name` of each message and workflow state to the key of its entry in `types` | [packages/bus-messages/src/message-types.ts:56](https://github.com/node-ts/bus/blob/2e6cf65c27833b707ae31ee623cfb6343770f434/packages/bus-messages/src/message-types.ts#L56) |
| <a id="property-source"></a> `source?` | `string` | Identifies the generated file, e.g. `@my-org/messages/src/message-types.generated`, so an error about two message types that conflict can say where each comes from | [packages/bus-messages/src/message-types.ts:51](https://github.com/node-ts/bus/blob/2e6cf65c27833b707ae31ee623cfb6343770f434/packages/bus-messages/src/message-types.ts#L51) |
| <a id="property-types"></a> `types` | `object` | How to restore each class or object type, by key | [packages/bus-messages/src/message-types.ts:61](https://github.com/node-ts/bus/blob/2e6cf65c27833b707ae31ee623cfb6343770f434/packages/bus-messages/src/message-types.ts#L61) |
