ericleib / ngx-remark

Render markdown with custom Angular templates
MIT License
8 stars 5 forks source link

Unable to add ngx-remark to Angular 17x project #2

Open realog32 opened 2 months ago

realog32 commented 2 months ago

The following error message is received during the initial build right after installing the package and adding the RemarkModule to the project:

Error: node_modules/ngx-remark/remark-node.component.d.ts:3:10 - error TS2459: Module '"mdast"' declares 
'Node' locally, but it is not exported.

3 import { Node } from "mdast";
           ~~~~

  node_modules/@types/mdast/index.d.ts:1:35
    1 import { Literal as UnistLiteral, Node, Parent as UnistParent } from "unist";
                                        ~~~~
    'Node' is declared here.

Error: node_modules/ngx-remark/remark-node.component.d.ts:9:37 - error TS2694: Namespace '"........./node_modules/@types/mdast/index"' has no exported member 'RootContent'.

9     get children(): import("mdast").RootContent[];
                                      ~~~~~~~~~~~

Error: node_modules/ngx-remark/remark.component.d.ts:5:16 - error TS2459: Module '"mdast"' declares 'Node' locally, but it is not exported.

5 import { Root, Node } from 'mdast';
                 ~~~~

  node_modules/@types/mdast/index.d.ts:1:35
    1 import { Literal as UnistLiteral, Node, Parent as UnistParent } from "unist";
                                        ~~~~
    'Node' is declared here.

× Failed to compile.

On closer inspection the latest @types/mdast package does not export a Node type as is expected by ngx-remark.

ericleib commented 2 months ago

Hello, Thank you for reporting this. I had a look but I do not reproduce the issue. The library is currently on version 4.0.3 of the @types/mdast package. I tried upgrading it to the latest (4.0.4, published 4 months ago), and it still exports the Node type.

Can you check which version of the library is installed in your project ? Have you installed remark version 15.0.1 ? (it's a peer dependency)