Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TsDefaultValue ¶
Types ¶
type Entity ¶
type Entity struct { Name string Value string Type string // "class", "function", or "object" or "interface" or "const" Description string Example string // this will be part of description with @example jsdoc tag Class Class // if Type == "class" Function Function // if Type == "function" Object Interface // if Type == "object" IsConstructor bool // true if this is a constructor function }
Define a struct to hold information about your TypeScript entities
type EntityParser ¶
type EntityParser struct {
// contains filtered or unexported fields
}
EntityParser is responsible for parsing a go file and generating corresponding typescript entities.
func NewEntityParser ¶
func NewEntityParser(dir string) (*EntityParser, error)
NewEntityParser creates a new EntityParser
func (*EntityParser) GetEntities ¶
func (p *EntityParser) GetEntities() []Entity
func (*EntityParser) Parse ¶
func (p *EntityParser) Parse() error
Parse parses the given file and generates corresponding typescript entities
type Function ¶
Function represents a TypeScript function data structure If CanFail is true, the function returns a Result<T, E> type So modify the function signature to return a Result<T, E> type in this case
type Method ¶
type Method struct { Name string Description string Parameters []Parameter Returns string CanFail bool ReturnStmt string }
Method represents a TypeScript method data structure If CanFail is true, the method returns a Result<T, E> type So modify the method signature to return a Result<T, E> type in this case