tw5-typed 0.2.18 → 0.2.19

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
@@ -2,7 +2,7 @@
2
2
  "description": "Types for tiddlywiki",
3
3
  "license": "MIT",
4
4
  "name": "tw5-typed",
5
- "version": "0.2.18",
5
+ "version": "0.2.19",
6
6
  "url": "https://github.com/tiddly-gittly/tw5-typed",
7
7
  "homepage": "https://github.com/tiddly-gittly/tw5-typed",
8
8
  "bugs": {
@@ -16,6 +16,9 @@
16
16
  "files": [
17
17
  "src/"
18
18
  ],
19
+ "scripts": {
20
+ "check": "tsc --noEmit && eslint src/**/*.ts"
21
+ },
19
22
  "husky": {
20
23
  "hooks": {
21
24
  "pre-commit": "lint-staged"
@@ -32,16 +35,15 @@
32
35
  "devDependencies": {
33
36
  "@modern-js/eslint-config": "latest",
34
37
  "@modern-js/tsconfig": "latest",
35
- "@types/codemirror": "^5.60.6",
36
- "@types/echarts": "^4.9.16",
37
- "@types/node": "^18.11.9",
38
38
  "husky": "^8.0.2",
39
39
  "lint-staged": "^13.1.0",
40
40
  "rimraf": "^3.0.2",
41
41
  "tiddlywiki": "^5.2.5",
42
42
  "typescript": "^4.9.4"
43
43
  },
44
- "scripts": {
45
- "check": "tsc --noEmit && eslint src/**/*.ts"
44
+ "dependencies": {
45
+ "@types/codemirror": "^5.60.6",
46
+ "@types/echarts": "^4.9.16",
47
+ "@types/node": "^18.11.9"
46
48
  }
47
- }
49
+ }
@@ -1,5 +1,5 @@
1
1
  declare module 'tiddlywiki' {
2
- declare class Story {
2
+ export class Story {
3
3
  wiki: Wiki;
4
4
  storyTitle: string;
5
5
  historyTitle: string;
@@ -9,7 +9,7 @@ declare const addEventListeners: (
9
9
  }[],
10
10
  ) => void;
11
11
 
12
- declare class Notifier {
12
+ export class Notifier {
13
13
  /**
14
14
  * Display a notification
15
15
  * * title: Title of tiddler containing the notification text
@@ -53,7 +53,7 @@ declare module 'tiddlywiki' {
53
53
  * * parentWidget: optional reference to a parent renderer node for the context chain
54
54
  * * document: optional document object to use instead of global document
55
55
  */
56
- export declare class Widget {
56
+ export class Widget {
57
57
  parseTreeNode: IParseTreeNode;
58
58
 
59
59
  wiki: ITiddlyWiki;
@@ -311,7 +311,7 @@ declare module 'tiddlywiki' {
311
311
  };
312
312
  }
313
313
 
314
- export module '$:/core/modules/widgets/widget.js' {
314
+ declare module '$:/core/modules/widgets/widget.js' {
315
315
  import { Widget } from 'tiddlywiki';
316
316
  export { Widget as widget };
317
317
  }
@@ -6,7 +6,7 @@ declare const getModificationFields: () => {
6
6
  declare const getTiddlersWithTag: (tag: string) => string[];
7
7
 
8
8
  declare module 'tiddlywiki' {
9
- class Wiki {
9
+ export interface Wiki {
10
10
  getCreationFields: typeof getCreationFields;
11
11
 
12
12
  getModificationFields: typeof getModificationFields;
@@ -197,13 +197,9 @@ declare module 'tiddlywiki' {
197
197
  * $tw.utils.each([1, 2, 3], element => console.log(element));
198
198
  * $tw.utils.each({ a: 1, b: 2 }, (value, key) => console.log(key, value));
199
199
  */
200
- each: <T>(
200
+ each: <T, K = T extends Array<any> ? number : keyof T>(
201
201
  object: T,
202
- callback: (
203
- element: T[keyof T],
204
- index: keyof T,
205
- object: T,
206
- ) => void | false,
202
+ callback: (element: T[K], index: K, object: T) => void | false,
207
203
  ) => void;
208
204
 
209
205
  /**
@@ -213,10 +209,10 @@ declare module 'tiddlywiki' {
213
209
  * 产生一个 DOM 元素
214
210
  *
215
211
  * @param {string} tag tag name
216
- * @param {IDomMakerOptions} options
212
+ * @param {IDomMakerOptions} [options]
217
213
  * @returns {TWElement}
218
214
  */
219
- domMaker: (tag: string, options: IDomMakerOptions) => TWElement;
215
+ domMaker: (tag: string, options?: IDomMakerOptions) => TWElement;
220
216
 
221
217
  /**
222
218
  * @en
@@ -257,6 +257,6 @@ declare module 'tiddlywiki' {
257
257
  getShadowSource(title: string): string | null;
258
258
  getTiddlerBacklinks(targetTitle: string): string[];
259
259
  getTiddlerLinks(title: string): string[];
260
- getPluginInfo(title: string): { tiddlers: ITiddlerFields[] };
260
+ getPluginInfo(title: string): { tiddlers: Record<string, ITiddlerFields> };
261
261
  }
262
262
  }