chore(script_deployer): basic typecheck

This commit is contained in:
Elian Doran
2026-04-22 20:32:02 +03:00
parent ae787b8f82
commit 5e9c514596
4 changed files with 54 additions and 6 deletions
@@ -24,8 +24,6 @@ const XOPP_COLORS = {
white: "#ffffff",
};
// Hi there.
function convertColor(color) {
if (!color) return "#000000";
const lower = color.toLowerCase();
+45
View File
@@ -0,0 +1,45 @@
/**
* Ambient type declarations for the virtual modules available inside
* Trilium user scripts (`trilium:preact` and `trilium:api`).
*
* These modules don't exist on disk — the server rewrites imports at
* runtime — but providing declarations here gives us editor
* intellisense and `tsc` checking for scripts in the `scripts/` dir.
*/
declare module "trilium:preact" {
export {
Component,
Fragment,
createContext,
createElement,
createRef,
h,
render,
} from "preact";
export {
useCallback,
useContext,
useEffect,
useLayoutEffect,
useMemo,
useReducer,
useRef,
useState,
} from "preact/hooks";
}
declare module "trilium:api" {
/** Run a function on the backend. The first arg is serialised. */
export function runOnBackend<T>(fn: (...args: any[]) => T, params?: any[]): Promise<T>;
/** Show a toast message. */
export function showMessage(message: string, timeout?: number): void;
/** Show an error toast. */
export function showError(message: string, timeout?: number): void;
/** Navigate to a note by its ID. */
export function activateNote(noteId: string): Promise<void>;
}
+6 -4
View File
@@ -1,9 +1,11 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"composite": false,
"emitDeclarationOnly": false,
"noEmit": true
"noEmit": true,
"allowJs": true,
"checkJs": true,
"jsx": "react-jsx",
"jsxImportSource": "preact"
},
"include": ["src"]
"include": ["src", "scripts"]
}
+3
View File
@@ -71,6 +71,9 @@
},
{
"path": "./scripts"
},
{
"path": "./apps/script-deployer"
}
]
}