-
-
Notifications
You must be signed in to change notification settings - Fork 223
Closed
Labels
questionA user questionA user question
Description
Describe the bug
I export two constants in my .svelte component.
<script lang="ts">
export const DEFAULT_WEIGHT = .75;
export const WEIGHT_ENCODING_EXPONENT = 1000;
</script>I import them in a .ts file. Svelte check says this is an error, but it compiles fine.
import CrankingForm from './CrankingForm.svelte';Error: Property 'DEFAULT_WEIGHT' does not exist on type 'Component<Record<string, never>, { DEFAULT_WEIGHT: 0.75; WEIGHT_ENCODING_EXPONENT: 1000; }, "">'.
form.weight > 0
&& form.weight !== CrankingForm.DEFAULT_WEIGHT * CrankingForm.WEIGHT_ENCODING_EXPONENT
);
packer.ts:70:79
Error: Property 'WEIGHT_ENCODING_EXPONENT' does not exist on type 'Component<Record<string, never>, { DEFAULT_WEIGHT: 0.75; WEIGHT_ENCODING_EXPONENT: 1000; }, "">'.
form.weight > 0
&& form.weight !== CrankingForm.DEFAULT_WEIGHT * CrankingForm.WEIGHT_ENCODING_EXPONENT
);
I cannot imagine what else it could possibly want me to do. Moving the constants to a <script module> block instead of the default (non-module) block makes no difference.
Reproduction
<!-- CrankingForm.svelte -->
<script lang="ts">
export const DEFAULT_WEIGHT = .75;
export const WEIGHT_ENCODING_EXPONENT = 1000;
</script>// packer.ts
import CrankingForm from './CrankingForm.svelte';
export default abstract class Packer {
protected packWeight() {
return form.weight !== CrankingForm.DEFAULT_WEIGHT * CrankingForm.WEIGHT_ENCODING_EXPONENT;
}
}Expected behaviour
This should not be an error at all, since the property does exist.
System Info
- OS: Windows
- IDE: PhpStorm
Which package is the issue about?
svelte-check
Additional Information, eg. Screenshots
No response
Metadata
Metadata
Assignees
Labels
questionA user questionA user question