Open danielclausmeyer opened 7 months ago
In the steps to reproduce i only how to reproduce the second error i described. For the first one i would need to add svelte-package and a build step and etc. Though I guess both errors have the same source/reason, so i hope this is enough.
Did this work in previous versions? I feel like that most likely never really worked
Indeed I cant reproduce it working with any version now. In our project there are no problems with version 0.4.1 and below. The problems start with version 0.5.0.
But when i try it with a clean install like in the steps to reproduce i can not get it to work with the same versions. Though the code is valid and should not throw errors either way.
Why does astro check
check TS files?
Indeed I cant reproduce it working with any version now. In our project there are no problems with version 0.4.1 and below. The problems start with version 0.5.0.
But when i try it with a clean install like in the steps to reproduce i can not get it to work with the same versions. Though the code is valid and should not throw errors either way.
Why does
astro check
check TS files?
There are multiple reasons, notably that we can provide Astro specific diagnostics and it's one of the few ways to support checking in the CLI .ts(x) files that import Astro components.
Since doing those checks is a very expensive process, doing it in one command is generally super beneficial performance wise as well, not to mention the memory usage.
Describe the Bug
We got a component library with Svelte components. Those are build and packed using "svelte-package". For each
.svelte
file it creates a.svelte.d.ts
file with the component type class and the props, events and slots.In a TypeScript file i am importing one of those prop types with
import type { Props } from '@org/package/component/Component.svelte'
.astro check
complains since version 0.5.0 that thisProps
is not exported from the file. It definitely is exported.I could also use the barrel file export of the component and then use the
ComponentProps
util type from svelte, but even thenastro check
complains about problems that do not actually exist.Why would
astro check
run checks on any file except.astro
files anyway?Steps to Reproduce
npm init astro
using template framework-svelteCounter.svelte
to export thecount
variable.type Props = ComponentProps
const props: Props = { count: 5 }
console.log(props)
npx astro check 13:45:56 [vite] Forced re-optimization of dependencies 13:45:56 [check] Getting diagnostics for Astro files in /workspaces/vofficeGmbh/test/superior-sphere... src/file.ts:4:29 - error ts(2749): 'Counter' refers to a value, but is being used as a type here. Did you mean 'typeof Counter'?
4 type Props = ComponentProps
Result (5 files):