#Astro test tsc compile error

1 messages · Page 1 of 1 (latest)

winter plover
#

Running tsc results in errors. This can be reproduced by adding the script in the example repo.

Cannot find module '../src/components/Card.astro' or its corresponding type declarations.

Adding the exclude config in tsconfig is not a solution as another error comes up when opening the test file

Cannot find module 'astro:container' or its corresponding type declaration

This is a reproducible example of the issue https://codesandbox.io/p/devbox/reverent-wright-zdfjy6?file=%2Fpackage.json%3A12%2C25

winter plover
#

Probably <@&1129102257422610512> have any idea why this is happening?

coral viper
#

Astro has a compiler that compiles astro components into js/ts files. tsc has no idea what to do with a .astro file and also wouldn't know how to read it

#

May I ask why you want to run tsc?

winter plover
#

I see

#

So I have tsc as a part of type checking, lint for compilation issue. Can I take it as changing it to astro check is sufficient? I believe the command read the tsconfig

coral viper
#

Yes, you should use astro check for that 🙂

winter plover
#

Great! Thank you!