Skip to content

Svelte + TypeScript problem: Inner component is not defined #37

Description

@patryk-m-malinowski

Hi. I am unable to get a Meteor app to work with Svelte + TypeScript. The issue is that if an outer (i.e. parent) component imports and uses an inner component (i.e. child), and the outer component has <script lang="ts"> , I get an exception in the browser that the inner component is undefined. Not sure if this is a problem with my setup or a bug. I have attached a demo zip file
demo.zip
containing a basic Meteor Svelte app which reproduces this issue on my machine. Happens in Meteor versions 2.16 and 3.0.1 .

Reproduction:
I run the command meteor run, and there are no errors in the command output. However, when I open the app in the browser, I get the following error in the browser console:
undefined-component

More information for you:
-The app works fine when I change the <script lang="ts> tags to <script> and change the TypeScript to vanilla JS, but I really want to be able to take advantage of the benefits that TypeScript offers.
-There is a workaround where if I reference the inner component from inside the <script> tag of the outer, it fixes the problem, but I would be quite ugly to do this when I have to import loads of components.
-Someone else had the same issue as me and posted about it on StackOverflow: https://stackoverflow.com/questions/74529394/why-is-my-svelte-component-undefined-in-meteor-project . They didn't report of fixing the issue. The workaround that I did also works for them.
-Happens in both Chromium and Firefox.
-svelte-preprocess is installed

If this is the wrong project to report this bug, please forgive me.

Thank you.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions