Functions & methods #71
Unanswered
jordanfowler
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Hey @jordanfowler, I imagine it's mostly possible generate the typing of functions, but I'm not sure what the usecase for it would be? If you are doing this at a small scale: I would propose to write your own typings instead of making this tool do it. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Can tygo generate function & method type definitions? I don't see this anywhere in your README or when using the CLI to generate my types. I understand the fact that Go supports multiple return values while Typescript does not, however, it seems like there should be an elegant solution to this, here's an idea:
func Foo() string
generate equivalent Typescript:function Foo(): string
func Bar() (string, error)
generate Typescript using a tuple return type:func Bar(): [string, error]
func Baz() (name string)
generate equivalent Typescript:func Baz(): { name: string }
I'm certain you've thought through this already and have much more insight. If you'd like help, I'm happy to throw together a PR.
Beta Was this translation helpful? Give feedback.
All reactions