v1.0.0

TypeScript

bongo ships ambient JSX types for its custom elements and attributes, and exports types for the config and the build.

JSX types

Extend the bundled config in your tsconfig.json:

tsconfig.jsonjson
{
	"extends": "bongo/tsconfig",
	"compilerOptions": {
		// your own settings
	}
}

The augmentation adds:

  • the <bongo:asset>, <bongo:client>, <bongo:image>, <bongo:script>, and <bongo:style> intrinsic elements,
  • transition:name and transition:animate on every HTML element,
  • transition:disable and prefetch:disable on anchors.

Or reference the types directly:

TypeScript
/// <reference types="bongo/jsx" />

See Special elements, View transitions, and Opt out.

Exported types

Import types from bongo:

Type Use
Config The config. Write export default {…} satisfies Config. See Config.
Loader A loader in $loaders. See Loaders.
Build.Transform A $hooks.transform function. See Hooks.
Build.Context The ctx of a hook.
Build.Data What the default export of a data module gets when it is a function. See Data modules.
Images.Options The $images config field. See Image config.
content/search.json.tsts
import type { Build } from 'bongo';

export default ({ $pages }: Build.Data) => $pages.map(page => ({ title: page.title, path: page.path }));

Import the client runtime types from bongo/client: ClientOptions, BongoEvent, and BongoEventDetails. See Client runtime.

Edit this page on GitHub MIT license · bongo v1.0.0

    Type to search page titles and sections.