Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for enums in the CLI tool #62

Open
anish749 opened this issue Jul 30, 2022 · 1 comment
Open

Add support for enums in the CLI tool #62

anish749 opened this issue Jul 30, 2022 · 1 comment

Comments

@anish749
Copy link

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.

@jkurtz678
Copy link

Agree, i am running into this as well. Would be extremely useful if it also created types for the enums.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants