tsimport

package
v0.0.38-alpha1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	GetAbsPathToRoot() string
	ShouldUseRelativePaths() bool
}

type Imports

type Imports struct {
	// contains filtered or unexported fields
}

Imports keeps track of imports in a generated typescript file

func NewImports

func NewImports(cfg Config, filePath string) *Imports

NewImports is the constructor for Imports filePath is path that's currently being written

func (*Imports) Export

func (imps *Imports) Export(path string, exports ...string) (string, error)

func (*Imports) ExportAll

func (imps *Imports) ExportAll(path string) (string, error)

func (*Imports) ExportAllAs

func (imps *Imports) ExportAllAs(path, as string) (string, error)

func (*Imports) FuncMap

func (imps *Imports) FuncMap() template.FuncMap

FuncMap returns the FuncMap to be passed to a template

func (*Imports) Reserve

func (imps *Imports) Reserve(path string, exports ...string) (string, error)

Reserve reserves a path and list of exports

func (*Imports) ReserveAll

func (imps *Imports) ReserveAll(path, as string) (string, error)

ReserveAll reserves importing all from a path as the alias

func (*Imports) ReserveDefault

func (imps *Imports) ReserveDefault(path, defaultExport string, exports ...string) (string, error)

ReserveDefault reserves the default export from a path and a list of exports

func (*Imports) String

func (imps *Imports) String() (string, error)

Returns a list of imported lines

func (*Imports) Use

func (imps *Imports) Use(export string) (string, error)

Use makes use of an export and ensures that's imported

func (*Imports) UseMaybe

func (imps *Imports) UseMaybe(export string) (string, error)

Jump to

Keyboard shortcuts

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