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:
{
"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:nameandtransition:animateon every HTML element,transition:disableandprefetch:disableon anchors.
Or reference the types directly:
/// <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. |
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.