runem / web-component-analyzer

CLI that analyzes web components and emits documentation
https://runem.github.io/web-component-analyzer
MIT License
507 stars 65 forks source link

Members' `type` functions now accept an optional descendant context declaration. #256

Open bicknellr opened 1 year ago

bicknellr commented 1 year ago

Component members are discovered within the context of some declaration associated with a single AST node. If that declaration has free type parameters, then asking the type checker for that declaration's AST node's type will return a type that still contains those free type parameters. Further, different choices for those type parameters in descendant component declarations may cause the type of the member to vary.

To allow a member to return its type with all type arguments substituted, members' type functions can now optionally be passed a component declaration that (inclusively) descends from the member's declaration. The type returned will be the type of this member for an instance of the given declaration.