Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 800 Bytes

README.md

File metadata and controls

40 lines (32 loc) · 800 Bytes

Plugin 🧩 TS

Export your golang types to TS for your frontend

Credits to Tygo PKG

Usage :

Import it to your code 🔠

    import (
        tspl "github.com/PiterWeb/Alf-Router/plugins/ts"
    )

Use it on your start point and change Packages with the names of the modules where are the types you want. For default all public types on the default module will be already included

    err := alf.App(&alf.AppConfig{
    	Port: "3000",
    	Routes: alf.CreateRouter([]alf.Route{
    		{
    			...
    		},
    	}),
		Plugins: []alf.Plugin{
			tspl.TS_plugin{
				Packages: []string{
					"github.com/exampleUser/myProject/submodule",
				},
				OutputFolder: "./ts-types",
			},
		},
    })

	if err != nil {
		panic(err)
	}