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

TS: Is there a way to automatically generate the attributes type of a custom element? #106

Open
xcatliu opened this issue Oct 23, 2018 · 1 comment

Comments

@xcatliu
Copy link
Collaborator

xcatliu commented Oct 23, 2018

Currently we need to write the attributes type manually like this:

// This is the only way to set the attributes type of a custom element
// @TODO @xcatliu We are working on a tool to build the type definition automatically 
//
// https://github.com/Microsoft/TypeScript/issues/4648
declare global {
    namespace JSX {
        interface IntrinsicElements {
            'hello-omi': Omi.CustomElementBaseAttributes & {
                msg: string;
                'prop-from-parent': string;
                onAbc: (e: Event) => void;
            };
        }
    }
}

We need a tool to build the type definition automatically

@xcatliu xcatliu changed the title TS issue: Is there a way to automatically generate the attributes type of a custom element? Oct 23, 2018
@xcatliu
Copy link
Collaborator Author

xcatliu commented Sep 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant