Skip to content

Type errors for component target #1999

@brunnerh

Description

@brunnerh

When passing components around:

import type { ComponentType } from 'svelte';
import Messages from './messages.svelte';

let component: ComponentType;
component = Messages;
Type 'typeof Messages__SvelteComponent_' is not assignable to type 'ComponentType<SvelteComponentTyped<any, any, any>>'.
  Types of parameters 'options' and 'options' are incompatible.
    Type 'ComponentConstructorOptions<any>' is not assignable to type 'Svelte2TsxComponentConstructorParameters<{ messages?: string[] | undefined; clear?: (() => void) | undefined; add?: ((message: string) => void) | undefined; }>'.
      Types of property 'target' are incompatible.
        Type 'Element | ShadowRoot | Document' is not assignable to type 'Element | ShadowRoot'.
          Type 'Document' is not assignable to type 'Element | ShadowRoot'.
            Type 'Document' is missing the following properties from type 'ShadowRoot': delegatesFocus, host, mode, slotAssignment, innerHTMLts(2322)

A potential fix for this was merged a while ago in this PR:

Is there a reason why this has not been published yet?
Maybe the issue should have been opened first?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions