svelte-intellij
svelte-intellij copied to clipboard
Support SvelteComponentTyped in Component instances
When a library uses SvelteComponentTyped
to define props, events, & slots on a component, the plugin should index the props, events, & slots.
I have a working implementation of using SvelteComponentTyped
. The state of the art seems like it's in flux.
MenuSearchBox/MenuSearchBox_T.ts
import type { SvelteComponentTyped } from 'svelte'
import type { MenuSearchBox_c } from './MenuSearchBox_c'
import type { MenuSearchBox_itemclicked_evt_I } from './MenuSearchBox_itemclicked_evt_I'
export interface MenuSearchBox_T extends SvelteComponentTyped</*@formatter:off*/
{ click_action:string },
{ itemclicked:CustomEvent<MenuSearchBox_itemclicked_evt_I> }
>/*@formatter:on*/ {
readonly _:MenuSearchBox_c
}
MenuSearchBox/index.ts
import in_MenuSearchBox from './MenuSearchBox.svelte'
import type { MenuSearchBox_T } from './MenuSearchBox_T'
export const MenuSearchBox = in_MenuSearchBox as unknown as MenuSearchBox_T
export * from './MenuSearchBox_T'
export * from './MenuSearchBox_itemclicked_evt_I'
DependentComponent.svelte - on:itemclicked should have autocomplete & type information
<script lang=ts>
import { MenuSearchBox } from './MenuSearchBox'
import type { MenuSearchBox_itemclicked_evt_I } from './MenuSearchBox'
function onitemclicked(evt:MenuSearchBox_itemclicked_evt_I) {
// ...
}
</script>
<MenuSearchBox on:itemclicked={evt => onitemclicked(evt)}></MenuSearchBox>
Great to see this already has some attention. Is this on the roadmap?
Hi @tomblachut! Do you have any updates on this? Thank you