ts

package
v0.0.0-...-8d3c269 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 5 Imported by: 0

README

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)
	}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TS_plugin

type TS_plugin struct {
	Packages     []string
	OutputFolder string
}

func (TS_plugin) Init_plugin

func (plugin TS_plugin) Init_plugin(_ *alf.AppConfig) error

Jump to

Keyboard shortcuts

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