InterfaceDescription

InterfaceDescription

A class describing an entity's interface, containing information about the name of the entity, it's properties and it's inheritance. This class provides getters to construct Typescript interfaces as strings, from the object's contents.

Constructor

new InterfaceDescription(name, typedProperties, inheritsnullable)

Source:
A class describing an entity's interface, containing information about the name of the entity, it's properties and it's inheritance. This class provides getters to construct Typescript interfaces as strings, from the object's contents.
Parameters:
Name Type Attributes Description
name string
typedProperties Array.<TypedProperty>
inherits string <nullable>
Throws:
if name or typedProperties are missing, an error will be thrown.
Type
MissingArgumentError

Members

imports

Source:
This getter returns a string of valid ESModule imports based on the types used by properties and inheritance within this interface.

interfaceDeclaration

Source:
This method generates and returns the interface declaration line of typescript for the described entity, including extending an interface defined as inherited.

interfaceProperties

Source:
This method generates a string consisting of valid typescript, defining the properties that the entity exposes.

typeFileString

Source:
This method generates a string consisting of valid typescript, defining a Typescript Interface including imports, interface declaration, properties, inheritance and default export of the interface.

uniqueTypes

Source:
This method returns an array of strings containing the names of the unique data types leveraged by this interface.