Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

(feat) be able to type props/events/slots#437

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
dummdidumm wants to merge1 commit intosveltejs:master
base:master
Choose a base branch
Loading
fromdummdidumm:component-def

Conversation

dummdidumm
Copy link
Member

@dummdidummdummdidumm commentedAug 10, 2020
edited
Loading

Through a new reserved interfaceComponentDef

See new tests for examples.

Generics

Problem to be solved: Generics. We cannot useinstanceOf(ComponentName) anymore, because this way we cannot pass in the information about the type of the generic.

If we have

Child:

<scriptlang="ts">interfaceComponentDef<T>{props:{items:T[]},events:{itemClick:CustomEvent<T>;}slots:{}}</script>// ...

Parent:

<Childitems="{['a', 'stringarray']}"on:itemClick="{iShouldBeOfTypeString => ...}"/>

We need a transformation that makes sure thatiShouldBeOfTypeString actually is inferred asstring. My current idea is to transform this tonew Child({props: {...allPropsAndItsValuesThatAreDefinedOnTheChild}}).$on instead of the oldinstanceOf(Child).$on.

A completely different idea is to somehow use Function Components instead of Class components. But I'm not sure if we can use this with all the other constraints we have.

Thoughts?

Through a new reserved interface "ComponentDef"
@jasonlyu123
Copy link
Member

Maybe we can add a dummy helper function like__sveltets_norename or__sveltets_generated to retain the no-rename of oldinstanceOf

dummdidumm reacted with thumbs up emoji

@Evertt
Copy link

Hey guys, any idea when this will be completed? 👼
I'm running up against this very issue right now and for now I'm just usingany instead of a generic type, but you know, a generic type would be nice. 😁

albertms10 reacted with eyes emoji

@dummdidumm
Copy link
MemberAuthor

This implementation will very likely not land in this form.This RFC is where the discussion is happening and the details are specified. After that the implementation will follow.

Evertt reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@dummdidumm@jasonlyu123@Evertt

[8]ページ先頭

©2009-2025 Movatter.jp