Skip to content
New issue

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

Angular import marked error #2926

Closed
unsky559 opened this issue Aug 8, 2023 · 5 comments
Closed

Angular import marked error #2926

unsky559 opened this issue Aug 8, 2023 · 5 comments

Comments

@unsky559
Copy link

unsky559 commented Aug 8, 2023

Marked version: 7.0.1

Describe the bug
When I trying to add Marked into my Angular project I got that errors:

Error: node_modules/marked/lib/marked.d.ts:449:5 - error TS1383: Only named e
xports may use 'export type'.

449     export type * from "MarkedOptions";
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/marked/lib/marked.d.ts:450:5 - error TS1383: Only named e
xports may use 'export type'.

450     export type * from "rules";
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/marked/lib/marked.d.ts:451:5 - error TS1383: Only named e
xports may use 'export type'.

451     export type * from "Tokens";
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here is my component`s code fragments:

import {marked} from "marked";
updateNode(update: HTMLParagraphElement){
    this.node.content = update.innerText;

    this.parsedContent = marked.parse(update.innerText);
  }
@UziTech
Copy link
Member

UziTech commented Aug 8, 2023

Seems like it is probably something to do with your tsconfig. Can you create a minimal repo so I can try to recreate this error?

@unsky559
Copy link
Author

unsky559 commented Aug 8, 2023

Sure! There it is: https://github.com/unsky559/t012
See the Editable component in src\app\editable\editable.component.ts.
Please use ng serve or npm run start to start your local server.

@UziTech
Copy link
Member

UziTech commented Aug 9, 2023

looks like this was fixed in typescript v5 microsoft/TypeScript#37238

@UziTech UziTech closed this as completed Aug 10, 2023
@mcdurdin
Copy link

Yes, these types were introduced in 7.0.1. This forces dependents to be on Typescript 5.0+ in order to use Marked 7.0.1+, which is unfortunate.

@unsky559
Copy link
Author

unsky559 commented Aug 17, 2023

Thank you all. I have updated my Typescript version to 5 and Angular version to 16 so that solved my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants