Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add JSDoc example #8533

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ node_modules/
/playwright-report/
/playwright/.cache/
$__StoryList.tid
types/generated/
1 change: 0 additions & 1 deletion core/globals.d.ts

This file was deleted.

7 changes: 7 additions & 0 deletions core/modules/wiki.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ Adds the following properties to the wiki object:
/*global $tw: false */
"use strict";

/**
* @typedef {import('$:/core/modules/widgets/widget.js').widget} Widget
*/

/**
* @type {Widget}
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the 2 comment blocks be merged to 1 block, or do we need 2 of them?

var widget = require("$:/core/modules/widgets/widget.js");

var USER_NAME_TITLE = "$:/status/UserName",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"bin": {
"tiddlywiki": "./tiddlywiki.js"
},
"types": "./types",
"main": "./boot/boot.js",
"repository": {
"type": "git",
Expand Down
9 changes: 5 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
"allowSyntheticDefaultImports": true,
"checkJs": true,
"declaration": true,
"declarationDir": "types",
"declarationDir": "types/generated",
"declarationMap": true,
"emitDeclarationOnly": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "Node16",
"outDir": "types",
"rootDir": "core",
"outDir": "types/generated",
"rootDir": ".",
"skipLibCheck": true,
"target": "ESNext"
},
"include": ["./core/**/*.js", "**/*.d.ts"]
"include": ["./core/**/*.js", "./core/**/*.d.ts", "types/tw.d.ts"],
"exclude": ["types/generated"]
}
7 changes: 7 additions & 0 deletions types/tw.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as Wiki from '../core/modules/wiki';

declare global {
var $tw: {
wiki: typeof Wiki;
};
}