remark-embedder / core

🔗 Remark plugin to convert URLs to embed code in markdown.
MIT License
118 stars 6 forks source link

CI is failing because of updated `unist` types #29

Closed MichaelDeBoey closed 3 years ago

MichaelDeBoey commented 3 years ago

Due to https://github.com/DefinitelyTyped/DefinitelyTyped/pull/54413, CI is now failing with

Error: [typecheck] src/index.ts(90,14): error TS2339: Property 'title' does not exist on type 'Literal<unknown, Data> & Parent<Node<Data>, Data>'.
Error: [typecheck] src/index.ts(92,26): error TS2339: Property 'value' does not exist on type 'Node<Data>'.
Error: [typecheck] src/index.ts(92,41): error TS2339: Property 'url' does not exist on type 'Literal<unknown, Data> & Parent<Node<Data>, Data>'.
Error: [typecheck] src/index.ts(97,14): error TS2339: Property 'url' does not exist on type 'Literal<unknown, Data> & Parent<Node<Data>, Data>'.
Error: [typecheck] src/index.ts(163,32): error TS2339: Property 'tagName' does not exist on type 'Parent<Node<Data>, Data>'.
Error: [typecheck] src/index.ts(164,38): error TS2339: Property 'properties' does not exist on type 'Parent<Node<Data>, Data>'.

@wooorm Can you point me into the right direction of fixing this please? I don't have a clue tbh. 🤔

wooorm commented 3 years ago

I believe it is https://github.com/DefinitelyTyped/DefinitelyTyped/pull/54181.

GuiltyDolphin commented 3 years ago

@MichaelDeBoey Yep, it'd be DefinitelyTyped/DefinitelyTyped#54181. The errors you're seeing mean that there are places in the code that are trying to use properties that are not guaranteed (by the types) to exist. I'd recommend extending the Node interface if you have particular properties that crop up again and again (e.g., the url).

wooorm commented 3 years ago

I would recommend using @types/mdast to type the nodes found in markdown. @types/unist is rather abstract, @types/mdast has the types you’re looking for.

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 1.4.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: