fix(readme): add destructure import example#92
Merged
octref merged 1 commit intoshikijs:masterfrom Nov 13, 2020
jefrydco:patch-1
Merged
fix(readme): add destructure import example#92octref merged 1 commit intoshikijs:masterfrom jefrydco:patch-1
octref merged 1 commit intoshikijs:masterfrom
jefrydco:patch-1
Conversation
Since in `index.ts` we don't export any default module, https://github.com/shikijs/shiki/blob/58cb92cd9427a97d5b4f89e3cec8e12290fcb793/packages/shiki/src/index.ts#L1-L6 it would raise an error like this, if we use `import shiki from 'shiki'` syntax. ``` The requested module 'file:///mnt/Data/Projects/Github/FORKED/test-cncd-shiki/node_modules/shiki/dist/index.js' does not provide an export named 'default' ```
Collaborator
|
That's a bad idea: https://basarat.gitbook.io/typescript/main-1/defaultisbad. |
Collaborator
|
Sorry but I don't really think it clarify anything. TS users should be able to figure this out themselves so I'm removing it. |
antfu
added a commit
that referenced
this pull request
Jan 26, 2024
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
1 task
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Since in
index.tswe don't export any default module,shiki/packages/shiki/src/index.ts
Lines 1 to 6 in 58cb92c
it would raise an error like this, if we use
import shiki from 'shiki'syntax.I think it's better to add destructure way to import
shiki.