We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
See 170db0f#diff-053321e287571cb967ea080e97a985fc8b87511b89ae85eb079a7c81ef7c22c9, it introduce markedOptions in config options, however, the package is not declaring @types/marked as deps, and marked itself does not have a type declaration file.
markedOptions
@types/marked
marked
So it will lead to issues like this in downstream projects, since the option is not typed:
plugins/plugin-comment/src/client/helpers/comment.ts:17:7 - error TS2322: Type 'Ref<{ comment?: boolean | undefined; delay?: number | undefined; pageTitle?: string | undefined; server?: string | undefined; site?: string | undefined; placeholder?: string | undefined; ... 35 more ...; beforeSubmit?: ((editor: EditorApi, next: () => void) => void) | undefined; }>' is not assignable to type 'Ref<ArtalkOptions>'. Type '{ comment?: boolean | undefined; delay?: number | undefined; pageTitle?: string | undefined; server?: string | undefined; site?: string | undefined; placeholder?: string | undefined; ... 35 more ...; beforeSubmit?: ((editor: EditorApi, next: () => void) => void) | undefined; }' is not assignable to type 'ArtalkOptions'. Type '{ comment?: boolean | undefined; delay?: number | undefined; pageTitle?: string | undefined; server?: string | undefined; site?: string | undefined; placeholder?: string | undefined; ... 35 more ...; beforeSubmit?: ((editor: EditorApi, next: () => void) => void) | undefined; }' is not assignable to type 'Partial<Omit<ArtalkConfig, "el" | "pageKey">>'. Types of property 'markedOptions' are incompatible. Type '{ hooks?: { options: ...; preprocess: (markdown: string) => string; postprocess: (html: string) => string; processAllTokens: (tokens: TokensList | Token[]) => TokensList | Token[]; } | null | undefined; ... 8 more ...; silent?: boolean | undefined; } | undefined' is not assignable to type 'MarkedOptions | undefined'. Type '{ hooks?: { options: ...; preprocess: (markdown: string) => string; postprocess: (html: string) => string; processAllTokens: (tokens: TokensList | Token[]) => TokensList | Token[]; } | null | undefined; ... 8 more ...; silent?: boolean | undefined; }' is not assignable to type 'MarkedOptions'. Types of property 'tokenizer' are incompatible. Type '{ options: { hooks?: { options: ...; preprocess: (markdown: string) => string; postprocess: (html: string) => string; processAllTokens: (tokens: TokensList | Token[]) => TokensList | Token[]; } | null | undefined; ... 8 more ...; silent?: boolean | undefined; }; ... 25 more ...; inlineText: (src: string) => Text | u...' is not assignable to type '_Tokenizer | null | undefined'. Type '{ options: { hooks?: { options: ...; preprocess: (markdown: string) => string; postprocess: (html: string) => string; processAllTokens: (tokens: TokensList | Token[]) => TokensList | Token[]; } | null | undefined; ... 8 more ...; silent?: boolean | undefined; }; ... 25 more ...; inlineText: (src: string) => Text | u...' is not assignable to type '_Tokenizer'. Types of property 'lexer' are incompatible. Type '{ tokens: { [x: number]: { type: "space"; raw: string; } | { type: "code"; raw: string; codeBlockStyle?: "indented" | undefined; lang?: string | undefined; text: string; escaped?: boolean | undefined; } | ... 19 more ... | { ...; }; ... 35 more ...; links: Links; }; ... 5 more ...; inlineTokens: (src: string, tokens...' is missing the following properties from type '_Lexer': tokenizer, inlineQueue 17 const comment: Ref<CommentOptions> = ref(commentOptions) ~~~~~~~ Found 1 error.
The text was updated successfully, but these errors were encountered:
marked 新版已内置了 ts 类型声明,@types/marked package has been deprecated.
这个问题实际上是由于客户端环境没有安装 marked 而 artalk 的 ts 类型声明又文件 import 了它。我能想到的解决办法是将 markedOptions 的类型改为 any 忽略类型报错,有更好的解决方案吗?
Sorry, something went wrong.
声明 marked 作为依赖对于下游环境来说可能更加友好,any能避免带来的安装时间增加,但对TS环境不友好。
还有一种可以尝试的解决方案是使用 rollup-plugin-dts 之类的插件把 marked 的类型打包进去。
fix(ui/types): remove marked dependency in dts (#868)
5865752
Any timetable for new versions?
No branches or pull requests
See 170db0f#diff-053321e287571cb967ea080e97a985fc8b87511b89ae85eb079a7c81ef7c22c9, it introduce
markedOptions
in config options, however, the package is not declaring@types/marked
as deps, andmarked
itself does not have a type declaration file.So it will lead to issues like this in downstream projects, since the option is not typed:
The text was updated successfully, but these errors were encountered: