Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 63ea910

Browse files
authored
Merge pull request #2029 from TriliumNext/refactor/typecheck_errors
Solve typecheck errors
2 parents 7823695 + 7651083 commit 63ea910

86 files changed

Lines changed: 345 additions & 1003 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
- uses: nrwl/nx-set-shas@v4
4141
- name: Check affected
42-
run: pnpm nx affected -t build rebuild-deps
42+
run: pnpm nx affected -t typecheck build rebuild-deps
4343

4444
report-electron-size:
4545
name: Report Electron size

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@
2626
".github/workflows/nightly.yml"
2727
],
2828
"typescript.validate.enable": true,
29-
"typescript.tsserver.experimental.enableProjectDiagnostics": true
29+
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
30+
"typescript.tsdk": "node_modules/typescript/lib",
31+
"typescript.enablePromptUseWorkspaceTsdk": true
3032
}

apps/client/src/components/app_context.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import type EditableTextTypeWidget from "../widgets/type_widgets/editable_text.j
2727
import type { NativeImage, TouchBar } from "electron";
2828
import TouchBarComponent from "./touch_bar.js";
2929
import type { CKTextEditor } from "@triliumnext/ckeditor5";
30+
import type CodeMirror from "@triliumnext/codemirror";
3031

3132
interface Layout {
3233
getRootWidget: (appContext: AppContext) => RootWidget;
@@ -191,7 +192,7 @@ export type CommandMappings = {
191192
ExecuteCommandData<CKTextEditor> & {
192193
callback?: GetTextEditorCallback;
193194
};
194-
executeWithCodeEditor: CommandData & ExecuteCommandData<CodeMirrorInstance>;
195+
executeWithCodeEditor: CommandData & ExecuteCommandData<CodeMirror>;
195196
/**
196197
* Called upon when attempting to retrieve the content element of a {@link NoteContext}.
197198
* Generally should not be invoked manually, as it is used by {@link NoteContext.getContentElement}.

apps/client/src/components/touch_bar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default class TouchBarComponent extends Component {
5454
#refreshTouchBar() {
5555
const { TouchBar } = this.remote;
5656
const parentComponent = this.lastFocusedComponent;
57-
let touchBar = null;
57+
let touchBar: Electron.CrossProcessExports.TouchBar | null = null;
5858

5959
if (this.$activeModal?.length) {
6060
touchBar = this.#buildModalTouchBar();

apps/client/src/entities/fnote.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ class FNote {
789789
*/
790790
async getRelationTargets(name: string) {
791791
const relations = this.getRelations(name);
792-
const targets = [];
792+
const targets: (FNote | null)[] = [];
793793

794794
for (const relation of relations) {
795795
targets.push(await this.froca.getNote(relation.value));

apps/client/src/services/clipboard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async function copy(branchIds: string[]) {
8080
if (utils.isElectron()) {
8181
// https://github.com/zadam/trilium/issues/2401
8282
const { clipboard } = require("electron");
83-
const links = [];
83+
const links: string[] = [];
8484

8585
for (const branch of froca.getBranches(clipboardBranchIds)) {
8686
const $link = await linkService.createLink(`${branch.parentNoteId}/${branch.noteId}`, { referenceLink: true });

apps/client/src/services/froca_updater.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async function processEntityChanges(entityChanges: EntityChange[]) {
5050
// To this we count: standard parent-child relationships and template/inherit relations (attribute inheritance follows them).
5151
// Here we watch for changes which might violate this principle - e.g., an introduction of a new "inherit" relation might
5252
// mean we need to load the target of the relation (and then perhaps transitively the whole note path of this target).
53-
const missingNoteIds = [];
53+
const missingNoteIds: string[] = [];
5454

5555
for (const { entityName, entity } of entityChanges) {
5656
if (!entity) {

apps/client/src/services/link.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ export function parseNavigationStateFromUrl(url: string | undefined) {
215215
const viewScope: ViewScope = {
216216
viewMode: "default"
217217
};
218-
let ntxId = null;
219-
let hoistedNoteId = null;
220-
let searchString = null;
218+
let ntxId: string | null = null;
219+
let hoistedNoteId: string | null = null;
220+
let searchString: string | null = null;
221221

222222
if (paramString) {
223223
for (const pair of paramString.split("&")) {

apps/client/src/services/promoted_attribute_definition_parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
type LabelType = "text" | "number" | "boolean" | "date" | "datetime" | "time" | "url";
22
type Multiplicity = "single" | "multi";
33

4-
interface DefinitionObject {
4+
export interface DefinitionObject {
55
isPromoted?: boolean;
66
labelType?: LabelType;
77
multiplicity?: Multiplicity;

apps/client/src/services/syntax_highlight.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function loadHighlightingTheme(themeName: string) {
9797
*/
9898
export function isSyntaxHighlightEnabled() {
9999
const theme = options.get("codeBlockTheme");
100-
return theme && theme !== "none";
100+
return !!theme && theme !== "none";
101101
}
102102

103103
/**

0 commit comments

Comments
 (0)