Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type errors in svelte2tsx #2498

Closed
Tracked by #1741
marekdedic opened this issue Sep 12, 2024 · 2 comments
Closed
Tracked by #1741

Type errors in svelte2tsx #2498

marekdedic opened this issue Sep 12, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@marekdedic
Copy link

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

@marekdedic marekdedic added the bug Something isn't working label Sep 12, 2024
dummdidumm added a commit that referenced this issue Sep 18, 2024
svelte-jsx and svelte-shims are used for Svelte 3 only, and are likely out of date, yet we don't want to invest time into adjusting them anymore, therefore silence any type errors in it.
Helps with #2498
@dummdidumm
Copy link
Member

Pushed a commit that helps silence this, release pending. But ultimately this is a misuage of svelte2tsx within Svelte Material UI. I opened hperrin/svelte-material-ui#665 for that.

@marekdedic
Copy link
Author

Great, thanks for both!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants