This node defines a named type that can be reused in other types using a DefinedTypeLinkNode
.
Attribute | Type | Description |
---|---|---|
kind |
"definedTypeNode" |
The node discriminator. |
name |
CamelCaseString |
The name of the reusable type. |
docs |
string[] |
Markdown documentation for the type. |
Attribute | Type | Description |
---|---|---|
type |
TypeNode |
The concrete type definition. |
Helper function that creates a DefinedTypeNode
object from an input object.
const node = definedTypeNode({
name: 'person',
docs: ['This type describes a Person.'],
type: structTypeNode([
structFieldTypeNode({ name: 'name', type: stringTypeNode('utf8') }),
structFieldTypeNode({ name: 'age', type: numberTypeNode('u8') }),
]),
});