Skip to content

Add support for enums in the CLI tool #62

@anish749

Description

@anish749

Following the docs I am doing

type MyEnum string

const (
	Val1 = MyEnum("val1")
	Val2 = MyEnum("val2")
)

var AllMyEnums = []MyEnum{ Val1, Val2 }

func (l MyEnum) TSName() string { 
	return string(l)
}

and now, when I run

tscriptify -package=package/with/your/models -target=target_ts_file.ts path/to/file/with/structs.go

it only generates for the other structs, and ignores the enum

when i looked at the code that is being generated, and added the line t.AddEnum(m.AllMyEnums) manually, it generated the ts file correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions