svelteuidev / svelteui

SvelteUI Monorepo
https://svelteui.dev
MIT License
1.31k stars 62 forks source link

Migrate our usage of internal API `get_current_component` to other alternative #471

Open BeeMargarida opened 1 year ago

BeeMargarida commented 1 year ago

What package has an issue

@svelteuidev/core

A clear and concise description of what the bug is

Type definitions for svelte/internal were removed for svelte 4: https://svelte.dev/docs/v4-migration-guide#other-breaking-changes, https://github.com/sveltejs/svelte/issues/9189

We are using get_current_component, which is an internal method. We should find another solution for this.

In which browser(s) did the problem occur?

Firefox

Steps To Reproduce

  1. Install codebase using svelte>=4
  2. Check TS errors when importing get_current_component in the codebase

Do you know how to fix the issue

Yes

Are you willing to participate in fixing this issue and create a pull request with the fix

Yes

Relevant Assets

No response

notramo commented 1 year ago

Does it mean that SvelteUI is not usable with Svelte 4 + TypeScript?

BeeMargarida commented 1 year ago

Does it mean that SvelteUI is not usable with Svelte 4 + TypeScript?

It's usable, the internal methods just don't have types, so it gives out TS errors inside the svelteui codebase.

notramo commented 1 year ago

Does it mean it willl throw TS errors when I run the type checker on my project?

BeeMargarida commented 1 year ago

Does it mean it willl throw TS errors when I run the type checker on my project?

No, I don't think so

iva2k commented 10 months ago

There's also another change in svelte/internal - beforeUpdate was moved to svelte, should also fix for that:

- import { beforeUpdate } from 'svelte/internal';
+ import { beforeUpdate } from 'svelte';