Skip to content

Comment source code functions for intellisense #4016

Description

@ThinkAndWander

In trying to supply a custom processAllTokens hook:

marked.marked.lexer(stringToParse, { hooks: { processAllTokens: tokens => tokens } })

Typescript wanted hooks to include all the other possible functions the Hooks object can have.

Type '{ processAllTokens: (tokens: TokensList | Token[]) => Token[]; }' is missing the following properties from type '_Hooks<string, string>': options, preprocess, postprocess, emStrongMask, and 2 more.

I eventually determined marked.use({ hooks: { works because it combines the hooks object, making it partial. However, this would've been easier if marked.use mentioned how this works in the intellisense, or if other options did. It's harder to connect the meaning of functions across the app. I think I could've saved a lot of time if the documentation included the source code functions.

(Very excellent software, by the way. I will be using this in my own project.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions