Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 1.31 KB

DefinedTypeNode.md

File metadata and controls

38 lines (27 loc) · 1.31 KB

DefinedTypeNode

This node defines a named type that can be reused in other types using a DefinedTypeLinkNode.

Diagram

Attributes

Data

Attribute Type Description
kind "definedTypeNode" The node discriminator.
name CamelCaseString The name of the reusable type.
docs string[] Markdown documentation for the type.

Children

Attribute Type Description
type TypeNode The concrete type definition.

Functions

definedTypeNode(input)

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') }),
    ]),
});