go2ts

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2023 License: MIT Imports: 12 Imported by: 0

README

go2ts

Code for Convert func copied from StirlingMarketingGroup/go2ts. This repo can be imported as a package for generating TypeScript from Go as part of a build workflow. Supports Go types StructType and ArrayType

Testing

Run all tests

git clone https://github.com/mozey/go2ts.git
cd go2ts
go test -v ./...

Demo

Run demo with deno.

Using TypeScript types that were generated from Go code

deno run testdata/example/demo/app.ts

Type usage is statically checked

deno run testdata/example/demo/err.ts

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Indent = "    "
View Source
var TSTypePrefix = "declare"

TSTypePrefix to use when generating the TypeScript types. See discussion re. "declare" vs "export" https://stackoverflow.com/q/35019987/639133

Functions

func Convert

func Convert(s string) (ts string, err error)

func ReadTypes added in v0.0.3

func ReadTypes(packagePath string) (s string, err error)

ReadTypes for all files in packagePath

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL