chore(script_deployer): basic typecheck
This commit is contained in:
@@ -24,8 +24,6 @@ const XOPP_COLORS = {
|
||||
white: "#ffffff",
|
||||
};
|
||||
|
||||
// Hi there.
|
||||
|
||||
function convertColor(color) {
|
||||
if (!color) return "#000000";
|
||||
const lower = color.toLowerCase();
|
||||
|
||||
+45
@@ -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>;
|
||||
}
|
||||
@@ -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"]
|
||||
}
|
||||
|
||||
@@ -71,6 +71,9 @@
|
||||
},
|
||||
{
|
||||
"path": "./scripts"
|
||||
},
|
||||
{
|
||||
"path": "./apps/script-deployer"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user