tw5-typed 0.7.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "tw5-typed",
3
- "version": "0.7.0",
3
+ "version": "1.0.0",
4
4
  "scripts": {
5
- "check": "tsc --noEmit && eslint src/**/*.ts",
5
+ "check": "tsc --noEmit && eslint src/**/*.ts test/**/*.ts",
6
6
  "docs": "docs-ts",
7
7
  "docs:build": "docusaurus build",
8
8
  "docs:dev": "docusaurus start",
@@ -10,7 +10,7 @@
10
10
  "docs:generate:api": "rimraf docs/api && typedoc --options typedoc.json",
11
11
  "docs:generate:copy": "zx scripts/copy-readme.mjs",
12
12
  "update": "npm-check-updates -u && dprint config update",
13
- "prepublishOnly": "tsc --noEmit"
13
+ "prepublishOnly": "npm run check"
14
14
  },
15
15
  "description": "Types for tiddlywiki",
16
16
  "license": "MIT",
@@ -13,7 +13,7 @@ declare module 'tiddlywiki' {
13
13
  export type ITWConfig = IConfig;
14
14
 
15
15
  export interface IConfig {
16
- [configName: string]: any;
16
+ [configName: string]: unknown;
17
17
  /** Map type to file content type */
18
18
  contentTypeInfo: Record<string, IContentTypeInfo>;
19
19
  /** @default 'TIDDLYWIKI_EDITION_PATH' */
@@ -58,7 +58,7 @@ declare module 'tiddlywiki' {
58
58
  build: ITiddlyWikiInfoJSONBuild;
59
59
  config: ITiddlyWikiInfoJSONConfig;
60
60
  description: string;
61
- languages: any[];
61
+ languages: unknown[];
62
62
  plugins: string[];
63
63
  themes: string[];
64
64
  }
@@ -1,5 +1,3 @@
1
- /// <reference path="config.d.ts" />
2
-
3
1
  declare module 'tiddlywiki' {
4
2
  export interface IBootFilesIndexItem {
5
3
  filepath: string;
package/src/core.d.ts CHANGED
@@ -1,12 +1,3 @@
1
- /// <reference path="hooks.d.ts" />
2
- /// <reference path="boot/index.d.ts" />
3
- /// <reference path="wiki/index.d.ts" />
4
- /// <reference path="utils/index.d.ts" />
5
- /// <reference path="tiddler/index.d.ts" />
6
- /// <reference path="modules/index.d.ts" />
7
- /// <reference path="plugins/index.d.ts" />
8
- /// <reference path="modules/utils/dom/index.d.ts" />
9
-
10
1
  declare module 'tiddlywiki' {
11
2
  export interface IPluginInfo {
12
3
  [pluginProperty: string]: string;
@@ -23,9 +14,8 @@ declare module 'tiddlywiki' {
23
14
 
24
15
  export interface IMacro {
25
16
  name: string;
26
- params: any[][];
27
- // eslint-disable-next-line @typescript-eslint/ban-types
28
- run: Function;
17
+ params: unknown[][];
18
+ run: (...arguments_: unknown[]) => unknown;
29
19
  }
30
20
 
31
21
  export type IWikiInfo = Record<string, unknown>;
@@ -46,7 +36,7 @@ declare module 'tiddlywiki' {
46
36
  * Add another unload task
47
37
  * @param task - Function to be called on unload
48
38
  */
49
- addUnloadTask(task: any): void;
39
+ addUnloadTask(task: () => void): void;
50
40
  boot: IBoot;
51
41
 
52
42
  browser: null | {
@@ -207,9 +197,9 @@ declare module 'tiddlywiki' {
207
197
  modules: IModules;
208
198
 
209
199
  /** NodeJS features, if tw isn't running on a NodeJS environment, the value will be `null` */
210
- node: null | Record<string, any>;
200
+ node: null | Record<string, unknown>;
211
201
  /** Broswer features, if tw isn't running on a browser environment, the value will be `null` */
212
- nodeWebKit: null | Record<string, any>;
202
+ nodeWebKit: null | Record<string, unknown>;
213
203
  notifier: Notifier;
214
204
  packageInfo: Record<string, unknown>;
215
205
  passwordPrompt: PasswordPrompt;
@@ -240,7 +230,7 @@ declare module 'tiddlywiki' {
240
230
  * Presents when we have $tw.syncadaptor
241
231
  */
242
232
  syncer?: Syncer;
243
- utils: IUtils;
233
+ utils: IUtilities;
244
234
  version: string;
245
235
  wiki: Wiki;
246
236
  }
package/src/hooks.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  declare module 'tiddlywiki' {
2
2
  interface ImportFileInfo {
3
- // eslint-disable-next-line @typescript-eslint/ban-types
4
- callback: Function;
3
+ callback: (tiddlerFieldsArray: unknown[]) => void;
5
4
  file: { lastModified?: number; lastModifiedDate?: Date; name: string; path?: string; size: number; type: string; webkitRelativePath?: string };
6
5
  isBinary: boolean;
7
6
  type: string;
@@ -18,23 +17,11 @@ declare module 'tiddlywiki' {
18
17
  ) => void,
19
18
  );
20
19
  addHook(
21
- hookName: 'th-saving-tiddler',
20
+ hookName: 'th-saving-tiddler' | 'th-renaming-tiddler' | 'th-relinking-tiddler',
22
21
  callback: (toTiddler: Tiddler, fromTiddler: Tiddler) => Tiddler | undefined,
23
22
  );
24
23
  addHook(
25
- hookName: 'th-renaming-tiddler',
26
- callback: (toTiddler: Tiddler, fromTiddler: Tiddler) => Tiddler | undefined,
27
- );
28
- addHook(
29
- hookName: 'th-relinking-tiddler',
30
- callback: (toTiddler: Tiddler, fromTiddler: Tiddler) => Tiddler | undefined,
31
- );
32
- addHook(
33
- hookName: 'th-importing-tiddler',
34
- callback: (tiddler: Tiddler) => Tiddler | undefined,
35
- );
36
- addHook(
37
- hookName: 'th-before-importing',
24
+ hookName: 'th-importing-tiddler' | 'th-before-importing',
38
25
  callback: (tiddler: Tiddler) => Tiddler | undefined,
39
26
  );
40
27
  addHook(
@@ -52,26 +39,9 @@ declare module 'tiddlywiki' {
52
39
  widget: Widget,
53
40
  ) => parseTreeNodes,
54
41
  );
55
- addHook(hookName: 'th-navigating', callback: (event: unknown) => unknown);
56
- addHook(
57
- hookName: 'th-closing-tiddler',
58
- callback: (event: unknown) => unknown,
59
- );
60
- addHook(
61
- hookName: 'th-editing-tiddler',
62
- callback: (event: unknown) => unknown,
63
- );
64
- addHook(
65
- hookName: 'th-cancelling-tiddler',
66
- callback: (event: unknown) => unknown,
67
- );
68
- addHook(hookName: 'th-new-tiddler', callback: (event: unknown) => unknown);
42
+ addHook(hookName: 'th-navigating' | 'th-closing-tiddler' | 'th-editing-tiddler' | 'th-cancelling-tiddler' | 'th-new-tiddler', callback: (event: unknown) => unknown);
69
43
  addHook(hookName: 'th-deleting-tiddler', callback: (title: Tiddler) => void);
70
- addHook(hookName: 'th-page-refreshed', callback: () => void);
71
- addHook(hookName: 'th-boot-tiddlers-loaded', callback: () => void);
72
- addHook(hookName: 'th-page-refreshed', callback: () => void);
73
- addHook(hookName: 'th-page-refreshing', callback: () => void);
74
- addHook(hookName: 'th-page-refreshed', callback: () => void);
44
+ addHook(hookName: 'th-page-refreshed' | 'th-boot-tiddlers-loaded' | 'th-page-refreshing', callback: () => void);
75
45
  addHook(
76
46
  hookName: 'th-importing-file',
77
47
  callback: (props: ImportFileInfo) => boolean | undefined,
@@ -81,7 +51,6 @@ declare module 'tiddlywiki' {
81
51
  * Invoke the hook by key
82
52
  */
83
53
  invokeHook(hookName: string, event: IWidgetEvent): undefined | IWidgetEvent;
84
- // eslint-disable-next-line @typescript-eslint/ban-types
85
- names: Record<string, Function[]>;
54
+ names: Record<string, Array<(...arguments_: unknown[]) => unknown>>;
86
55
  }
87
56
  }
package/src/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference path="core.d.ts" />
2
-
3
1
  import { ITiddlyWiki } from 'tiddlywiki';
4
2
 
5
3
  export * from 'tiddlywiki';
@@ -1,15 +1,3 @@
1
- /// <reference path="wiki.d.ts" />
2
- /// <reference path="story.d.ts" />
3
- /// <reference path="utils/index.d.ts" />
4
- /// <reference path="server/index.d.ts" />
5
- /// <reference path="parsers/index.d.ts" />
6
- /// <reference path="widgets/index.d.ts" />
7
- /// <reference path="indexers/index.d.ts" />
8
- /// <reference path="parsers/index.d.ts" />
9
- /// <reference path="syncer/syncAdaptor.d.ts" />
10
- /// <reference path="syncer/syncer.d.ts" />
11
- /// <reference path="keyboard.d.ts" />
12
-
13
1
  declare module 'tiddlywiki' {
14
2
  export interface ITWModuleExports {
15
3
  [exportName: string]: unknown;
@@ -10,24 +10,24 @@ declare module 'tiddlywiki' {
10
10
 
11
11
  // 定义键盘管理器类的接口
12
12
  export interface KeyboardManager {
13
- checkKeyDescriptor: (event: any, keyInfo: KeyInfo) => boolean;
14
- checkKeyDescriptors: (event: any, keyInfoArray: KeyInfo[]) => boolean;
13
+ checkKeyDescriptor: (event: KeyboardEvent, keyInfo: KeyInfo) => boolean;
14
+ checkKeyDescriptors: (event: KeyboardEvent, keyInfoArray: KeyInfo[]) => boolean;
15
15
  detectNewShortcuts: (
16
- changedTiddlers: Record<string, any>,
16
+ changedTiddlers: Record<string, unknown>,
17
17
  ) => boolean | string[];
18
- getEventModifierKeyDescriptor: (event: any) => string;
18
+ getEventModifierKeyDescriptor: (event: KeyboardEvent) => string;
19
19
  getMatchingKeyDescriptor: (
20
- event: any,
20
+ event: KeyboardEvent,
21
21
  keyInfoArray: KeyInfo[],
22
22
  ) => KeyInfo | null;
23
23
  getModifierKeys: () => number[];
24
24
  getPrintableShortcuts: (keyInfoArray: KeyInfo[]) => string[];
25
25
  getShortcutTiddlerList: () => string[];
26
26
  handleKeydownEvent: (
27
- event: any,
27
+ event: KeyboardEvent,
28
28
  options?: { onlyPriority?: boolean },
29
29
  ) => boolean;
30
- handleShortcutChanges: (changedTiddlers: Record<string, any>) => void;
30
+ handleShortcutChanges: (changedTiddlers: Record<string, unknown>) => void;
31
31
  keyNames: string[];
32
32
  lookupNames: string[];
33
33
  metaKeyName: string;
@@ -38,7 +38,7 @@ declare module 'tiddlywiki' {
38
38
  ) => KeyInfo | null;
39
39
  parseKeyDescriptors: (
40
40
  keyDescriptors: string[] | string,
41
- options?: { stack?: string[]; wiki?: any },
41
+ options?: { stack?: string[]; wiki?: Wiki },
42
42
  ) => KeyInfo[];
43
43
  shortcutActionList: string[];
44
44
  shortcutKeysList: string[];
@@ -69,13 +69,13 @@ declare module 'tiddlywiki' {
69
69
 
70
70
  requestHandler: ServerEndpointHandler;
71
71
 
72
- variables: Record<string, any>;
72
+ variables: Record<string, unknown>;
73
73
 
74
74
  routes: IRoute[];
75
75
 
76
76
  constructor(options: IServerOptions);
77
77
  addRoute(route: IRoute): void;
78
- get(variableName: string): any;
78
+ get(variableName: string): unknown;
79
79
  /**
80
80
  Listen for requests
81
81
  port: optional port number (falls back to value of "port" variable)
@@ -15,7 +15,7 @@ declare module '$:/core/modules/utils/crypto.js' {
15
15
  export function decryptStoreArea(
16
16
  encryptedStoreArea: string,
17
17
  password?: string,
18
- ): any[] | null;
18
+ ): unknown[] | null;
19
19
 
20
20
  /**
21
21
  * Prompts the user for a password and attempts to decrypt an encrypted store area using the provided password.
@@ -26,7 +26,7 @@ declare module '$:/core/modules/utils/crypto.js' {
26
26
  */
27
27
  export function decryptStoreAreaInteractive(
28
28
  encryptedStoreArea: string,
29
- callback: (tiddlers: any[]) => void,
29
+ callback: (tiddlers: unknown[]) => void,
30
30
  options?: { usePasswordVault?: boolean },
31
31
  ): void;
32
32
  }
@@ -22,7 +22,7 @@ declare module '$:/core/modules/utils/csv.js' {
22
22
  export function parseCsvString(
23
23
  text: string,
24
24
  options?: { separator?: string },
25
- ): any[][];
25
+ ): unknown[][];
26
26
 
27
27
  /**
28
28
  * Parse a CSV string with a header row and return an array of objects.
@@ -1,3 +0,0 @@
1
- /// <reference path="notifier.d.ts" />
2
- /// <reference path="dom.d.ts" />
3
- /// <reference path="modal.d.ts" />
@@ -1,6 +1,3 @@
1
- /// <reference path="../../widgets/index.d.ts" />
2
- /// <reference path="../../../wiki/index.d.ts" />
3
-
4
1
  declare module 'tiddlywiki' {
5
2
  export class Modal {
6
3
  constructor(wiki: Wiki);
@@ -5,5 +5,5 @@ declare module '$:/core/modules/utils/edition-info.js' {
5
5
  * @returns An object containing the edition information.
6
6
  * @returns 包含版本信息的对象。
7
7
  */
8
- export function getEditionInfo(): Record<string, any>;
8
+ export function getEditionInfo(): Record<string, unknown>;
9
9
  }
@@ -18,7 +18,7 @@ declare module 'tiddlywiki' {
18
18
  createElementNS: (namespace: string, tag: string) => TW_Element;
19
19
  createTextNode: (text: string) => TW_TextNode;
20
20
  isTiddlyWikiFakeDom: boolean;
21
- setSequenceNumber: (value: any) => void;
21
+ setSequenceNumber: (value: number) => void;
22
22
  }
23
23
  }
24
24
 
@@ -1,6 +1,3 @@
1
- /// <reference path="../../wiki/index.d.ts" />
2
- /// <reference path="../../tiddler/index.d.ts" />
3
-
4
1
  declare module 'tiddlywiki' {
5
2
  /**
6
3
  * File information for saving a tiddler
@@ -1,17 +1,3 @@
1
- /// <reference path="utils.d.ts" />
2
- /// <reference path="fakedom.d.ts" />
3
- /// <reference path="filesystem.d.ts" />
4
- /// <reference path="linked-list.d.ts" />
5
- /// <reference path="performance.d.ts" />
6
- /// <reference path="logger.d.ts" />
7
- /// <reference path="parsetree.d.ts" />
8
- /// <reference path="pluginmaker.d.ts" />
9
- /// <reference path="transliterate.d.ts" />
10
- /// <reference path="crypto.d.ts" />
11
- /// <reference path="csv.d.ts" />
12
- /// <reference path="edition-info.d.ts" />
13
- /// <reference path="escapecss.d.ts" />
14
-
15
1
  declare module 'tiddlywiki' {
16
2
  // Thanks for GitHub Copilot, you has helped me a lot!
17
3
  import * as dom from '$:/core/modules/utils/dom.js';
@@ -60,32 +60,32 @@ declare module '$:/core/modules/utils/linked-list.js' {
60
60
  * @description 创建链表的迭代器。
61
61
  */
62
62
  makeTiddlerIterator(
63
- wiki: any,
64
- ): (callback: (tiddler: any, title: string) => void) => void;
63
+ wiki: Wiki,
64
+ ): (callback: (tiddler: Tiddler, title: string) => void) => void;
65
65
  }
66
66
 
67
67
  class LLMap {
68
68
  /**
69
69
  * The map object.
70
70
  */
71
- map: Record<string, any>;
71
+ map: Record<string, unknown>;
72
72
  /**
73
73
  * The null value of the map.
74
74
  */
75
- null: any;
75
+ null: unknown;
76
76
  /**
77
77
  * Set a value in the map.
78
78
  * @param key - The key to set.
79
79
  * @param val - The value to set.
80
80
  * @description 在映射中设置值。
81
81
  */
82
- set(key: string | null, value: any): void;
82
+ set(key: string | null, value: unknown): void;
83
83
  /**
84
84
  * Get a value from the map.
85
85
  * @param key - The key to get.
86
86
  * @returns The value of the key.
87
87
  * @description 从映射中获取值。
88
88
  */
89
- get(key: string | null): any;
89
+ get(key: string | null): unknown;
90
90
  }
91
91
  }
@@ -68,7 +68,7 @@ declare module '$:/core/modules/utils/logger.js' {
68
68
  * @param args - The arguments to log.
69
69
  * @description 记录消息。
70
70
  */
71
- log(...arguments_: any[]): void;
71
+ log(...arguments_: unknown[]): void;
72
72
  /**
73
73
  * Get the message buffer.
74
74
  * @returns The message buffer.
@@ -80,13 +80,13 @@ declare module '$:/core/modules/utils/logger.js' {
80
80
  * @param value - The value to log.
81
81
  * @description 将结构记录为表格。
82
82
  */
83
- table(value: any): void;
83
+ table(value: unknown): void;
84
84
  /**
85
85
  * Alert a message.
86
86
  * @param args - The arguments to alert.
87
87
  * @description 警报消息。
88
88
  */
89
- alert(...arguments_: any[]): void;
89
+ alert(...arguments_: unknown[]): void;
90
90
  /**
91
91
  * Clear outstanding alerts.
92
92
  * @description 清除未处理的警报。
@@ -13,9 +13,9 @@ declare module '$:/core/modules/utils/parsetree.js' {
13
13
  * @description 向解析树节点添加属性。
14
14
  */
15
15
  export function addAttributeToParseTreeNode(
16
- node: any,
16
+ node: IParseTreeNode,
17
17
  name: string | object,
18
- value?: any,
18
+ value?: unknown,
19
19
  ): void;
20
20
 
21
21
  /**
@@ -24,7 +24,7 @@ declare module '$:/core/modules/utils/parsetree.js' {
24
24
  * @returns The ordered attributes.
25
25
  * @description 从解析树节点获取有序属性。
26
26
  */
27
- export function getOrderedAttributesFromParseTreeNode(node: any): any[];
27
+ export function getOrderedAttributesFromParseTreeNode(node: IParseTreeNode): unknown[];
28
28
 
29
29
  /**
30
30
  * Get attribute value from parse tree node.
@@ -35,10 +35,10 @@ declare module '$:/core/modules/utils/parsetree.js' {
35
35
  * @description 从解析树节点获取属性值。
36
36
  */
37
37
  export function getAttributeValueFromParseTreeNode(
38
- node: any,
38
+ node: IParseTreeNode,
39
39
  name: string,
40
- defaultValue?: any,
41
- ): any;
40
+ defaultValue?: unknown,
41
+ ): unknown;
42
42
 
43
43
  /**
44
44
  * Add class to parse tree node.
@@ -46,7 +46,7 @@ declare module '$:/core/modules/utils/parsetree.js' {
46
46
  * @param classString - The class string to add.
47
47
  * @description 向解析树节点添加类。
48
48
  */
49
- export function addClassToParseTreeNode(node: any, classString: string): void;
49
+ export function addClassToParseTreeNode(node: IParseTreeNode, classString: string): void;
50
50
 
51
51
  /**
52
52
  * Add style to parse tree node.
@@ -56,7 +56,7 @@ declare module '$:/core/modules/utils/parsetree.js' {
56
56
  * @description 向解析树节点添加样式。
57
57
  */
58
58
  export function addStyleToParseTreeNode(
59
- node: any,
59
+ node: IParseTreeNode,
60
60
  name: string,
61
61
  value: string,
62
62
  ): void;
@@ -69,9 +69,9 @@ declare module '$:/core/modules/utils/parsetree.js' {
69
69
  * @description 查找解析树节点。
70
70
  */
71
71
  export function findParseTreeNode(
72
- nodeArray: any[],
72
+ nodeArray: IParseTreeNode[],
73
73
  search: { tag: string; type: string },
74
- ): any;
74
+ ): IParseTreeNode | undefined;
75
75
 
76
76
  /**
77
77
  * Get the text of a parse tree node or array of nodes.
@@ -79,7 +79,7 @@ declare module '$:/core/modules/utils/parsetree.js' {
79
79
  * @returns The text of the parse tree node or array of nodes.
80
80
  * @description 获取解析树节点或节点数组的文本。
81
81
  */
82
- export function getParseTreeText(tree: any): string;
82
+ export function getParseTreeText(tree: IParseTreeNode | IParseTreeNode[]): string;
83
83
  /**
84
84
  * Serialize parse tree.
85
85
  * @param tree - The parse tree node or array of nodes.
@@ -48,7 +48,7 @@ declare module '$:/core/modules/utils/parseutils.js' {
48
48
  /**
49
49
  * Process parameters for macro invocation.
50
50
  */
51
- export function parseMacroParameters(node: any, source: string, pos: number): any;
51
+ export function parseMacroParameters(node: IParseTreeNode, source: string, pos: number): unknown[];
52
52
 
53
53
  /**
54
54
  * Look for a macro invocation parameter. Returns null if not found.
@@ -58,12 +58,12 @@ declare module '$:/core/modules/utils/parseutils.js' {
58
58
  /**
59
59
  * Look for a macro invocation. Returns null if not found.
60
60
  */
61
- export function parseMacroInvocation(source: string, pos: number): { end: number; name: string; params: any[]; start: number; type: 'macrocall' } | null;
61
+ export function parseMacroInvocation(source: string, pos: number): { end: number; name: string; params: unknown[]; start: number; type: 'macrocall' } | null;
62
62
 
63
63
  /**
64
64
  * Look for a macro invocation as transclusion. Returns null if not found.
65
65
  */
66
- export function parseMacroInvocationAsTransclusion(source: string, pos: number): { attributes: any; end: number; start: number; type: 'transclude' } | null;
66
+ export function parseMacroInvocationAsTransclusion(source: string, pos: number): { attributes: Record<string, unknown>; end: number; start: number; type: 'transclude' } | null;
67
67
 
68
68
  export interface FilterVariableParseTreeNode {
69
69
  name: string;
@@ -1,5 +1,3 @@
1
- /* eslint-disable @typescript-eslint/ban-types */
2
- /// <reference path="./logger.d.ts" />
3
1
  import { Logger } from '$:/core/modules/utils/logger.js';
4
2
 
5
3
  declare module '$:/core/modules/utils/performance.js' {
@@ -28,13 +26,13 @@ declare module '$:/core/modules/utils/performance.js' {
28
26
  */
29
27
  showGreeting(): void;
30
28
  /**
31
- * Wraps performance reporting around a top level function.
29
+ * Wraps performance reporting around top level functions.
32
30
  * @param name - The name of the function being wrapped.
33
31
  * @param fn - The function to wrap.
34
32
  * @returns The wrapped function.
35
33
  * @description 在顶层函数周围包装性能报告。
36
34
  */
37
- report(name: string, function_: Function): Function;
35
+ report<T extends (...arguments_: unknown[]) => unknown>(name: string, function_: T): T;
38
36
  /**
39
37
  * Logs performance measurements.
40
38
  * @description 记录性能测量。
@@ -47,6 +45,6 @@ declare module '$:/core/modules/utils/performance.js' {
47
45
  * @returns The wrapped function.
48
46
  * @description 在子函数周围包装性能测量。
49
47
  */
50
- measure(name: string, function_: Function): Function;
48
+ measure<T extends (...arguments_: unknown[]) => unknown>(name: string, function_: T): T;
51
49
  }
52
50
  }
@@ -1,3 +1,4 @@
1
+ /* eslint-disable unicorn/prevent-abbreviations */
1
2
  declare module '$:/core/modules/utils/utils.js' {
2
3
  type TerminalColourName =
3
4
  | 'black'
@@ -170,7 +171,7 @@ declare module '$:/core/modules/utils/utils.js' {
170
171
  * @returns True if the array item is an object property, false otherwise.
171
172
  * @description 确定数组项是否为对象属性。
172
173
  */
173
- export function hopArray(object: object, array: any[]): boolean;
174
+ export function hopArray(object: object, array: unknown[]): boolean;
174
175
 
175
176
  /**
176
177
  * Removes entries from an array.
@@ -209,7 +210,7 @@ declare module '$:/core/modules/utils/utils.js' {
209
210
  * @returns The extended object.
210
211
  * @description 从一个或多个源中复制属性来扩展对象。
211
212
  */
212
- export function extend(object: any, ...source: any[]): any;
213
+ export function extend<T = unknown>(object: T, ...source: unknown[]): T;
213
214
 
214
215
  /**
215
216
  * Deep copy an object.
@@ -217,7 +218,7 @@ declare module '$:/core/modules/utils/utils.js' {
217
218
  * @returns The copied object.
218
219
  * @description 深拷贝对象。
219
220
  */
220
- export function deepCopy(object: any): any;
221
+ export function deepCopy<T = unknown>(object: T): T;
221
222
 
222
223
  /**
223
224
  * Extend an object with properties from one or more sources, and deep copy the extended properties.
@@ -226,14 +227,14 @@ declare module '$:/core/modules/utils/utils.js' {
226
227
  * @returns The extended object.
227
228
  * @description 从一个或多个源中复制属性来扩展对象,并深拷贝扩展的属性。
228
229
  */
229
- export function extendDeepCopy(object: any, extendedProperties: any): any;
230
+ export function extendDeepCopy<T = unknown>(object: T, extendedProperties: unknown): T;
230
231
 
231
232
  /**
232
233
  * Recursively freeze an object and its properties.
233
234
  * @param object - The object to freeze.
234
235
  * @description 递归地冻结对象及其属性。
235
236
  */
236
- export function deepFreeze(object: any): void;
237
+ export function deepFreeze(object: unknown): void;
237
238
 
238
239
  /**
239
240
  * A slow-in, slow-out easing function.
@@ -502,7 +503,7 @@ declare module '$:/core/modules/utils/utils.js' {
502
503
  * @returns The tiddler dictionary format sequence of name:value pairs.
503
504
  * @description 将 hashmap 转换为 tiddler 字典格式的 name:value 对序列。
504
505
  */
505
- export function makeTiddlerDictionary(data: Record<string, any>): string;
506
+ export function makeTiddlerDictionary(data: Record<string, unknown>): string;
506
507
 
507
508
  /**
508
509
  * High resolution microsecond timer for profiling.
@@ -601,5 +602,5 @@ declare module '$:/core/modules/utils/utils.js' {
601
602
  invert?: boolean;
602
603
  isCaseSensitive?: boolean;
603
604
  },
604
- ): (a: any, b: any) => number;
605
+ ): (a: string, b: string) => number;
605
606
  }
@@ -1,6 +1,3 @@
1
- /// <reference path="./navigator.d.ts" />
2
- /// <reference path="./edit.d.ts" />
3
-
4
1
  declare module 'tiddlywiki' {
5
2
  /**
6
3
  * Parameter of Widget.refresh
@@ -89,8 +86,10 @@ declare module 'tiddlywiki' {
89
86
 
90
87
  parentDomNode?: Element;
91
88
 
92
- // eslint-disable-next-line @typescript-eslint/ban-types
93
- eventListeners: Record<string, Function>;
89
+ eventListeners: Record<
90
+ string,
91
+ Array<(event: IWidgetEvent) => undefined | Promise<void> | boolean>
92
+ >;
94
93
 
95
94
  /**
96
95
  * we can use $tw.rootWidget.widgetClasses.xxx to new a widget
@@ -1,4 +1,5 @@
1
1
  declare module '$:/plugins/Gk0Wk/echarts/echarts.min.js' {
2
+ // eslint-disable-next-line import/no-unresolved
2
3
  import ECharts from 'echarts';
3
4
  export = ECharts;
4
5
  }
@@ -1 +0,0 @@
1
- /// <reference path="echarts/index.d.ts" />
@@ -1,2 +0,0 @@
1
- /// <reference path="tiddlywiki/index.d.ts" />
2
- /// <reference path="Gk0Wk/index.d.ts" />
@@ -1 +0,0 @@
1
- /// <reference path="codemirror/index.d.ts" />
@@ -1,13 +1,11 @@
1
- /// <reference path="Crypto.d.ts" />
2
- /// <reference path="PasswordPrompt.d.ts" />
3
-
1
+ import type { Logger } from '$:/core/modules/utils/logger.js';
4
2
  import { Spread } from 'type-fest';
5
3
 
6
4
  declare module 'tiddlywiki' {
7
5
  export type TWDocument = Document | IFakeDocument;
8
6
  export type TWElement = Element;
9
7
  export type TWDOMElement = TWElement;
10
- export type ITWUtils = IUtils;
8
+ export type ITWUtilities = IUtilities;
11
9
 
12
10
  export interface IDomMakerOptions {
13
11
  /**
@@ -193,7 +191,7 @@ declare module 'tiddlywiki' {
193
191
  */
194
192
  each: <T, K = T extends unknown[] ? number : keyof T>(
195
193
  object: T,
196
- callback: (element: T[K], index: K, object: T) => undefined | false | void,
194
+ callback: (element: T[K], index: K, object: T) => false | undefined,
197
195
  ) => void;
198
196
 
199
197
  /**
@@ -456,7 +454,15 @@ declare module 'tiddlywiki' {
456
454
  * (Some pairs taken from http://semplicewebsites.com/ removing-accents-javascript)
457
455
  */
458
456
  transliterationPairs: Record<string, string>;
457
+ /**
458
+ * Logger class constructor
459
+ */
460
+ Logger: typeof Logger;
461
+ /**
462
+ * Parse a filter variable
463
+ */
464
+ parseFilterVariable: (source: string) => unknown;
459
465
  }
460
466
 
461
- export type IUtils = IUtilitiesBoot & IUtilsModules;
467
+ export type IUtilities = IUtilitiesBoot;
462
468
  }
@@ -1,5 +1,3 @@
1
- /// <reference path="../modules/filters/index.d.ts" />>
2
-
3
1
  declare module 'tiddlywiki' {
4
2
  export interface IMakeWidgetOptions {
5
3
  document?: TWDocument;
@@ -16,7 +14,7 @@ declare module 'tiddlywiki' {
16
14
  | 'text/html'
17
15
  | 'text/vnd.tiddlywiki'
18
16
  | 'text/plain';
19
- export type ITiddlerFieldsParam =
17
+ export type ITiddlerFieldsParameter =
20
18
  & Omit<
21
19
  Partial<ITiddlerFields>,
22
20
  'created' | 'modified'
@@ -24,7 +22,7 @@ declare module 'tiddlywiki' {
24
22
  & { created?: string; modified?: string };
25
23
  export type ITiddlerJSONResult =
26
24
  & Omit<
27
- Partial<ITiddlerFieldsParam>,
25
+ Partial<ITiddlerFieldsParameter>,
28
26
  'list' | 'tags'
29
27
  >
30
28
  & { list?: string; tags?: string };
@@ -37,7 +35,7 @@ declare module 'tiddlywiki' {
37
35
  */
38
36
  constructor(options: { enableIndexers: unknown[] });
39
37
  addIndexer(indexer: unknown, name: string): void;
40
- getTiddler<T extends Tiddler>(title: string): T | undefined;
38
+ getTiddler(title: string): Tiddler | undefined;
41
39
  /**
42
40
  * Get full list of tiddler titles in the wiki
43
41
  */
@@ -186,7 +184,7 @@ declare module 'tiddlywiki' {
186
184
  compileFilter(
187
185
  filterString: string,
188
186
  ): (
189
- source?: (iterator: SourceIterator) => void | string[] | Record<string, unknown>,
187
+ source?: ((iterator: SourceIterator) => void) | string[] | Record<string, unknown>,
190
188
  widget?: Widget,
191
189
  ) => string[];
192
190
  /**
@@ -222,21 +220,21 @@ declare module 'tiddlywiki' {
222
220
  setTiddlerData(
223
221
  title: string,
224
222
  data?: object,
225
- fields?: ITiddlerFieldsParam,
226
- options?: any,
223
+ fields?: ITiddlerFieldsParameter,
224
+ options?: { suppressTimestamp?: boolean },
227
225
  ): void;
228
226
  /**
229
227
  * Create or update tiddler.
230
228
  * Update existed tiddler based on the title field.
231
229
  */
232
230
  addTiddler(
233
- tiddler: Tiddler | Partial<ITiddlerFieldsParam> | Partial<ITiddlerFields>,
231
+ tiddler: Tiddler | Partial<ITiddlerFieldsParameter> | Partial<ITiddlerFields>,
234
232
  ): void;
235
233
  /**
236
234
  * Call `addTiddler` for each iton of the list, but should passing `tiddler.fields`, directly passing tiddler object may failed to add in some cases.
237
235
  */
238
236
  addTiddlers(
239
- tiddler: Array<Partial<ITiddlerFieldsParam> | Partial<ITiddlerFields>>,
237
+ tiddler: Array<Partial<ITiddlerFieldsParameter> | Partial<ITiddlerFields>>,
240
238
  ): void;
241
239
  /**
242
240
  * Get tiddler's text field, with an optional default text.
@@ -260,7 +258,7 @@ declare module 'tiddlywiki' {
260
258
 
261
259
  Alternative, uncached version of getTiddlerDataCached(). The return value can be mutated freely and reused
262
260
  */
263
- getTiddlerData<D extends Record<any, unknown> | any[] | undefined>(
261
+ getTiddlerData<D extends Record<string, unknown> | unknown[] | undefined>(
264
262
  titleOrTiddler: string | Tiddler,
265
263
  fallbackData?: D,
266
264
  ): D;
@@ -327,9 +325,9 @@ declare module 'tiddlywiki' {
327
325
  deserializeTiddlers(
328
326
  type: string,
329
327
  text: string,
330
- sourceFields?: ITiddlerFieldsParam,
328
+ sourceFields?: ITiddlerFieldsParameter,
331
329
  options?: IParseOptions,
332
- ): ITiddlerFieldsParam[];
330
+ ): ITiddlerFieldsParameter[];
333
331
  /**
334
332
  Parse text from a tiddler and render it into another format
335
333
  outputType: content type for the output
@@ -355,7 +353,7 @@ declare module 'tiddlywiki' {
355
353
  */
356
354
  renderText(
357
355
  outputType: OutputMimeTypes,
358
- textType: TextMimeTypes | string,
356
+ textType: string,
359
357
  text: string,
360
358
  options?: Partial<IMakeWidgetOptions> & IParseOptions,
361
359
  ): string;
@@ -494,7 +492,7 @@ declare module 'tiddlywiki' {
494
492
  * @param options Additional options
495
493
  * @deprecated Use story.addToStory() from the story object instead
496
494
  */
497
- addToStory(title: string | string[], fromTitle?: string, storyTitle?: string, options?: any): void;
495
+ addToStory(title: string | string[], fromTitle?: string, storyTitle?: string, options?: { openLinkFromInsideRiver?: boolean; openLinkFromOutsideRiver?: boolean }): void;
498
496
  /**
499
497
  * Add a new record to the top of the history stack
500
498
  * @param title A title string or an array of title strings
@@ -502,7 +500,7 @@ declare module 'tiddlywiki' {
502
500
  * @param historyTitle Title of history tiddler (defaults to $:/HistoryList)
503
501
  * @deprecated Use story.addToHistory() from the story object instead
504
502
  */
505
- addToHistory(title: string | string[], fromPageRect?: any, historyTitle?: string): void;
503
+ addToHistory(title: string | string[], fromPageRect?: unknown, historyTitle?: string): void;
506
504
  /**
507
505
  * Generate a draft title for a given tiddler
508
506
  * @param title Title of the tiddler to create a draft for
@@ -513,7 +511,7 @@ declare module 'tiddlywiki' {
513
511
  * @param title Title to slugify
514
512
  * @param options Options (currently unused)
515
513
  */
516
- slugify(title: string, options?: any): string;
514
+ slugify(title: string, options?: { separator?: string }): string;
517
515
  /**
518
516
  * Invoke the available upgrader modules
519
517
  * @param titles Array of tiddler titles to be processed
@@ -529,7 +527,7 @@ declare module 'tiddlywiki' {
529
527
  * Determine whether a plugin info structure is dynamically loadable
530
528
  * @param pluginInfo Plugin info object
531
529
  */
532
- doesPluginInfoRequireReload(pluginInfo: any): boolean | null;
530
+ doesPluginInfoRequireReload(pluginInfo: IPluginInfo): boolean | null;
533
531
  /**
534
532
  * Execute an action string without an associated context widget
535
533
  * @param actions Action string to execute
@@ -537,7 +535,7 @@ declare module 'tiddlywiki' {
537
535
  * @param variables Variables hashmap
538
536
  * @param options Options including parentWidget
539
537
  */
540
- invokeActionString(actions: string, event?: any, variables?: Record<string, string>, options?: { parentWidget?: Widget }): void;
538
+ invokeActionString(actions: string, event?: IWidgetEvent | null, variables?: Record<string, string>, options?: { parentWidget?: Widget }): void;
541
539
  /**
542
540
  * Read an array of browser File objects
543
541
  * @param files Array of File objects
@@ -614,7 +612,7 @@ declare module 'tiddlywiki' {
614
612
 
615
613
  removeEventListener(
616
614
  type: string,
617
- handler: (event: any) => void | Promise<void>,
615
+ handler: (event: unknown) => void | Promise<void>,
618
616
  ): void;
619
617
 
620
618
  addEventListener(