# trilium-types

> Type definitions for Trilium Notes.

Latest version **0.1.2** (published 2024-06-12) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install trilium-types
pnpm add trilium-types
yarn add trilium-types
bun add trilium-types
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2024-06-12 |
| First published | 2023-09-04 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 97.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Zerebos |
| Maintainers | zerebos |
| Keywords | trilium, notes, types |

## Links

- npm: https://www.npmjs.com/package/trilium-types
- Repository: https://github.com/rauenzi/trilium-types
- Issues: https://github.com/rauenzi/trilium-types/issues
- npm.io page: https://npm.io/package/trilium-types

## Dependencies (7)

- [axios](https://npm.io/package/axios.md) ^1.4.0
- [dayjs](https://npm.io/package/dayjs.md) ^1.11.9
- [@types/node](https://npm.io/package/@types/node.md) ^20.5.0
- [@types/jquery](https://npm.io/package/@types/jquery.md) ^3.5.16
- [@types/xml2js](https://npm.io/package/@types/xml2js.md) ^0.4.11
- [@types/codemirror](https://npm.io/package/@types/codemirror.md) ^5.60.8
- [@ckeditor/ckeditor5-editor-balloon](https://npm.io/package/@ckeditor/ckeditor5-editor-balloon.md) ^39.0.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2024-06-12
- 0.1.1 — 2023-09-19
- 0.1.0 — 2023-09-04

## README

# trilium-types

A [TypeScript](https://www.typescriptlang.org/) `@types` package for [Trilium Notes](https://github.com/zadam/trilium).

## Installation

```sh
npm install @types/trilium@npm:trilium-types
```

## Usage

This package keeps up with the latest version of Trilium available, there is not existing table or mapping showing old version of this package that correspond to old version of Trilium.

### TypeScript

The Trilium frontend `api` will automatically be available in all files since working with the frontend is the most common use-case. You can easily override this with the backend api if needed:

```js
import {BackendAPI} from "trilium/backend";

declare const api: BackendAPI;
```

Otherwise, all the types should be available under `trilium/frontend`, `trilium/backend`, and `trilium/common`.

### JavaScript

Similarly to in TypeScript, your IDE (like VSCode) should automatically pick up `api` as the frontend. You can override this using JSDoc syntax. First, make sure your IDE and/or linter are setup to allow an `api` global, then you can do.
```js
/**
 * @type {import("trilium/backend").BackendAPI}
 */
const api = api;
```

For other types, you can follow the same methodology and use the JSDoc syntax with `import`.


## Why?

Because it's nice to have autocompletion and type recognition whether you're using JS or TS.

### Why not [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/)?

I chose not to try to push this to DefinitelyTyped because I'm still an amateur when it comes to TypeScript and writing custom type definitions. They tend to have a quality requirement that I don't think I would meet.


## Links

Check out my other Trilium-based projects:
- [Trilium Markdown Preview](https://github.com/rauenzi/Trilium-MarkdownPreview/)
- [Trilium Breadcrumbs](https://github.com/rauenzi/Trilium-Breadcrumbs)

Want more? Be sure to check out the [Awesome Trilium](https://github.com/Nriver/awesome-trilium) list!

---
_Source: https://npm.io/package/trilium-types · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
