Skip to content

Typing this in unified plugin (specifically compiler) #244

Answered by wooorm
senicko asked this question in Q&A
Discussion options

You must be logged in to vote

Using index.ts and latest packages, VS code does show that type error.
I recommend adding at @ts-expect-error:

const ttsCompiler: Plugin<[], Root, CompiledArticle> = function () {
+ // @ts-expect-error
  this.compiler = compiler;

Or cast:

- function compiler(ast: Root, file: VFile): CompiledArticle {
+ function compiler(ast: Node, file: VFile): CompiledArticle {
+   const tree = ast as Root
    return { sections: [] };
  }

The unified types seem to tie a) what the current compiler could be, with b) the new compiler intended to be set.

Replies: 2 comments 14 replies

Comment options

You must be logged in to vote
3 replies
@senicko
Comment options

@ChristianMurphy
Comment options

@senicko
Comment options

Comment options

You must be logged in to vote
11 replies
@senicko
Comment options

@wooorm
Comment options

@senicko
Comment options

@wooorm
Comment options

Answer selected by senicko
@senicko
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants