Skip to content

Type errors in svelte2tsx #2498

@marekdedic

Description

@marekdedic

Describe the bug

Hello, I'm getting multiple type errors in svelte2tsx after disabling skipLibCheck:

/home/user/project/node_modules/svelte2tsx/svelte-jsx.d.ts:49:95
Error: Type 'Property' cannot be used to index type 'IntrinsicElements'.
    Omit<
      Omit<import('svelte/elements').SvelteHTMLElements[Property], keyof EventsWithColon<Omit<svelte.JSX.IntrinsicElements[Property & string], svelte.JSX.AttributeNames>>> & EventsWithColon<Omit<svelte.JSX.IntrinsicElements[Property & string], svelte.JSX.AttributeNames>>,
      keyof Override


/home/user/project/node_modules/svelte2tsx/svelte-jsx.d.ts:49:196
Error: Type 'Property' cannot be used to index type 'IntrinsicElements'.
    Omit<
      Omit<import('svelte/elements').SvelteHTMLElements[Property], keyof EventsWithColon<Omit<svelte.JSX.IntrinsicElements[Property & string], svelte.JSX.AttributeNames>>> & EventsWithColon<Omit<svelte.JSX.IntrinsicElements[Property & string], svelte.JSX.AttributeNames>>,
      keyof Override


/home/user/project/node_modules/svelte2tsx/svelte-jsx.d.ts:60:13
Error: Interface 'IntrinsicElements' incorrectly extends interface 'SvelteHTMLElements'.
  The types of ''svelte:window'['on:devicemotion']' are incompatible between these types.
    Type 'EventHandler<DeviceMotionEvent, HTMLElement> | null | undefined' is not assignable to type 'EventHandler<DeviceMotionEvent, Element> | null | undefined'.
      Type 'EventHandler<DeviceMotionEvent, HTMLElement>' is not assignable to type 'EventHandler<DeviceMotionEvent, Element>'.
        Types of parameters 'event' and 'event' are incompatible.
          Type 'DeviceMotionEvent & { currentTarget: EventTarget & Element; }' is not assignable to type 'DeviceMotionEvent & { currentTarget: EventTarget & HTMLElement; }'.
            Type 'DeviceMotionEvent & { currentTarget: EventTarget & Element; }' is not assignable to type '{ currentTarget: EventTarget & HTMLElement; }'.
              Types of property 'currentTarget' are incompatible.
                Type 'EventTarget & Element' is not assignable to type 'EventTarget & HTMLElement'.
                  Type 'EventTarget & Element' is missing the following properties from type 'HTMLElement': accessKey, accessKeyLabel, autocapitalize, dir, and 123 more.
  // the following type construct makes sure that we can use the new typings while maintaining backwards-compatibility in case someone enhanced the old typings
  interface IntrinsicElements extends Omit<RemoveIndex<svelte.JSX.IntrinsicElements>, keyof RemoveIndex<import('svelte/elements').SvelteHTMLElements>> {
    a: HTMLProps<'a', HTMLAttributes>;


/home/user/project/node_modules/svelte2tsx/svelte-jsx.d.ts:246:5
Error: Duplicate index signature for type 'string'.

    [name: string]: { [name: string]: any };
  }

Reproduction

skaut/shared-drive-mover#1741

Expected behaviour

No error

System Info

  • OS: Ubuntu 22.04

Which package is the issue about?

svelte2tsx

Additional Information, eg. Screenshots

Svelte2tsx v0.7.17

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions