tscheck

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tscheck type-checks the TypeScript islands of an app with the native TypeScript compiler (REQ-ISL-08). The compiler is the Go port of TypeScript: one binary for each platform, with no node. gx downloads the pinned release for the host, verifies its sha256 from gx.lock and runs it, as it does for Tailwind.

Index

Constants

View Source
const DefaultBaseURL = "https://registry.npmjs.org"

DefaultBaseURL is the npm registry. A platform package is at <base>/@typescript/typescript-<platform>/-/<asset>.

View Source
const DefaultVersion = "7.0.2"

DefaultVersion is the pinned TypeScript release. From release 7.0 the compiler is native code.

Variables

This section is empty.

Functions

func App

App is the whole check of an app, as `gx check` runs it: the check of the compiler, then the TypeScript check of the islands. The TypeScript check needs the generated props files, so it does not run while the compiler reports a stale file or an island with no props.

func Asset

func Asset(version, goos, goarch string) (string, error)

Asset returns the package file name of a GOOS and GOARCH at one version.

func HasLock

func HasLock(root string) bool

HasLock reports whether gx.lock pins the compiler.

func SaveLock

func SaveLock(root string, entry LockEntry) error

SaveLock merges the typescript pin into gx.lock without touching other sections.

Types

type LockEntry

type LockEntry struct {
	Version string            `json:"version"`
	SHA256  map[string]string `json:"sha256,omitempty"`
}

LockEntry pins the compiler in gx.lock.

func DefaultLock

func DefaultLock() LockEntry

DefaultLock returns the built-in pin.

func LoadLock

func LoadLock(root string) (LockEntry, error)

LoadLock reads the typescript section of gx.lock, or returns the built-in pin when the file or the section is absent.

type Manager

type Manager struct {
	// Root is the app directory that holds gx.lock and gx.toml.
	Root string
	// Cache overrides the cache directory.
	Cache string
	// BaseURL overrides the registry, for mirrors (REQ-STY-12) and tests.
	BaseURL string
	// Client is the HTTP client. The default client honours HTTPS_PROXY.
	Client *http.Client
}

Manager fetches and runs the pinned compiler.

func (*Manager) Check

func (m *Manager) Check(ctx context.Context) ([]compiler.Diagnostic, error)

Check type-checks every island of the app and returns one GX6005 for each TypeScript error. An app with no island runs no compiler and needs no download. An app with a tsconfig.json is checked as that project.

func (*Manager) Ensure

func (m *Manager) Ensure(ctx context.Context) (string, error)

Ensure returns the path of the compiler binary. It unpacks the verified package next to the cache entry one time; the directory name holds the sha256, so a different package never reuses it.

func (*Manager) Vendor

func (m *Manager) Vendor(ctx context.Context) (string, error)

Vendor stores the pinned package in .gx/vendor for offline builds (REQ-STY-12).

Jump to

Keyboard shortcuts

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