compiler issue: @Prop decorator on variable with 'keyof typeof' results in components.d.ts that lacks class import
Stencil version:
1.13.0
I'm submitting a: [x] bug report
Current behavior: Having a @Prop of type 'keyof typeof SomeEnumClass' will not compile properly. if that SomeEnumClass is not otherwise referenced in the component.
when running e.g. npm run start
compiler will generate a components.d.ts that does not include an import of SomeEnumClass.
Resulting Error:
TypeScript: ./src/components.d.ts "Cannot find name 'SomeEnumClass'.
But if i create another prop with that class, then components.d.ts properly imports in the class. e.g. @Prop propName: keyof typeof EnumClass @Prop prop2Name: EnumClass
<WORKS!>
Expected behavior:
Should generate the proper components.d.ts imports if type is 'keyof typeof Enumclass'
Steps to reproduce: Create a stencil component with
@Prop propName: keyof typeof EnumClass and do not have any other reference to that EnumClass in the component.
npm run start will fail.
Hey there 👋
I apologize that it took so long for someone on the team to acknowledge the issue. I've confirmed that this is indeed an issue and am going to label it to get it into the backlog for the team to take a closer look at.
I'm planning to work on this by teaching the type-reference collector to include names from TypeQueryNode expressions, with focused compiler tests for local and imported enum/class references.