-
Notifications
You must be signed in to change notification settings - Fork 794
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
bug: @Prop can't work with typescript's Type alias #3124
Comments
Hey @zhuxindaba 👋 Can you please add a reproduction to GitHub so that we may take a closer look? This greatly helps speed up the time it takes to diagnose and triage issues. Thanks! |
Sorry, this is demo reproduction: https://github.com/zhuxindaba/stencil-demo/tree/master/demo-test |
It is not about type alias, it is because you use type that is private (only accessible within one file). If you want to make it work just define ButtonTypes in separate file, e.g. |
Thx, I define the type in seperate file, it works. But, how can i use type alias privately? |
Types used within Prop or Method cannot be private, as they are accessed outside of the component. |
Hey @zhuxindaba, @MarkChrisLevy is correct here - it's difficult to declare a import { Component, h } from '@stencil/core';
@Component({
tag: 'my-parent',
shadow: true,
})
export class MyParent {
render() {
// if we don't make the type of `first` public with `export`, how do we know it is
// that 'primary' is allowed?
return <my-component first={"primary"}></my-component>;
}
} However, I think this could be improved on the Stencil end in 2 ways:
I'm going to label this issue to get it added to our backlog + for the team to discuss this further |
thanks for your reply,i'm look forward stencil will solve the problem dynamically when compiling project. |
ionic-team/stencil-site#784 has been created to address the documentation gap |
Prerequisites
Stencil Version
2.7.0
Current Behavior
Expected Behavior
can work correctly
Steps to Reproduce
none
Code Reproduction URL
none
Additional Information
No response
The text was updated successfully, but these errors were encountered: