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 ¶
const DefaultBaseURL = "https://registry.npmjs.org"
DefaultBaseURL is the npm registry. A platform package is at <base>/@typescript/typescript-<platform>/-/<asset>.
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 ¶
func App(ctx context.Context, dir string, opt compiler.CheckOptions) ([]compiler.Diagnostic, error)
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.
Types ¶
type LockEntry ¶
type LockEntry struct {
Version string `json:"version"`
SHA256 map[string]string `json:"sha256,omitempty"`
}
LockEntry pins the compiler in gx.lock.
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 ¶
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.