-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
chore: output type definitions #2392
Draft
trusktr
wants to merge
5
commits into
develop
Choose a base branch
from
type-definitions
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f6ffc04
output type definitions and adjust package.json so that types are pic…
trusktr 2387399
ignore dist in prettierignore
trusktr 1a352af
deprecate globals and global script data-* attributes, and set up the…
trusktr 355469f
add dist to eslintignore
trusktr 4a867ad
fix typo
trusktr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
/_playwright-report | ||
/_playwright-results | ||
/lib | ||
/dist | ||
/node_modules | ||
/.husky/_ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"cSpell.words": ["coverpage"] | ||
"cSpell.words": ["coverpage"], | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"checkJs": true, | ||
|
||
"module": "NodeNext", | ||
"moduleResolution": "NodeNext", | ||
"target": "ESNext", | ||
"lib": ["DOM", "ESNext"], | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"resolveJsonModule": true, | ||
"outDir": "dist/" | ||
}, | ||
"include": ["src/**/*.js"], | ||
"exclude": [ | ||
// "./**/*.test.js", | ||
// "test/", | ||
// "jest.config.js", | ||
// "middleware.js", | ||
// "playwright.config.js", | ||
// "server.configs.js", | ||
// "server.js" | ||
] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR currently compiles every
.js
file in/src/core
and/src/plugins
to a corresponding.ts
file/dist
. It is not emitting ad.ts
file. This is after a clean install.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The screenshot shows
.d.ts
declaration files, which is the expected result. That's what makes the types available in the demo:https://github.com/docsifyjs/docsify-template-plain-js-type-checked/blob/main/index.js
however the demo has docsify locally symlinked, which includes the src code. The lib otherwise doesn't export anything from the index file.
I converted the PR into a draft. Perhaps first we should export
Docsify
and allow it to accept options withnew Docsify({...})
and deprecate global$docsify
as a way to move towards a componentization, non-globals, and ESM, and then having the type defs will make a lot more sense.Our tests didn't fail (the PR went green (EDIT: it was green in this commit, but my new commit failed something)). However GitHub seems to have some feature that is automatically showing us type errors in the
Files changed
tab now (?), but this is not failing our own checks. I recommend we disable it if that's possible, or just ignore it, then fix errors as we go rather than refactoring code all in one PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok here's what I'll do:
$docsify
in the same PRnew Docsify
, along with type support as above).Let me know if you prefer the change to be separate (it won't be a big additional change, you'll be able to take a look at the specific commit).