expressive-code / expressive-code

A text marking & annotation engine for presenting source code on the web.

Home Page:https://expressive-code.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warning with Astro

alexnguyennz opened this issue · comments

Hi I'm getting a warning of Argument type { themes: string[] } is not assignable to parameter type AstroExpressiveCodeOptions | undefined with WebStorm with astro.config.mjs open:

With a config of:

astroExpressiveCode({ themes: ["dracula"] }),

Using:

astro@4.2.6
astro-expressive-code@0.32.2

Hello! This is a strange warning - your input looks like a perfectly valid config to me.

What do your tsconfig.json, package.json and full Astro config file look like? If your repo is public, I'd love to have a look.

Just an idea because I never used WebStorm and know that they had some issues supporting Astro projects in the past: Could you try opening your project in VS Code instead just to see if this is an IDE error and not really an EC issue?

Yeah WebStorm's support with .astro files isn't great.

The repo is here.

There's no error in VS Code and if I change the extension to .ts, the warning goes away in WebStorm.

Not a big deal anyway since it doesn't affect anything but thought I would report it in case.

Thank you for the repo link! Yes, unfortunately this seems to be a WebStorm issue. It's looking fine on my end in VS Code as well - the types are there and working correctly.

After looking through your repo, I have two remaining ideas on what you could try changing in your tsconfig.json:

  • You could try adding mjs to your include list:
    "include": ["**/*.ts", "**/*.tsx", "**/*.mjs", "**/*.astro"]
  • You could try removing the exclude of node_modules.

If these also don't help after making the changes and restarting WebStorm, I'm unfortunately out of ideas. I'd close this issue then as it's unlikely to be an EC issue, but an IDE issue, and there is nothing I can do about it. But thank you for reporting this anyway, it's always good to know where users might be struggling and good to have seen this error!

Thanks for the suggestions - they don't seem to affect the warning. No worries, I'll close this now.