chore: fix i18n property type in CEM output using @type JSDoc overrides#11383
Open
web-padawan wants to merge 1 commit intomainfrom
Open
chore: fix i18n property type in CEM output using @type JSDoc overrides#11383web-padawan wants to merge 1 commit intomainfrom
web-padawan wants to merge 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Should this also be applied to mixins? vaadin-date-picker-mixin still shows object. Same for attributes, though I'm not sure what "type" there even implies since those are always strings.
Member
Author
There was a problem hiding this comment.
Thanks, sounds reasonable. I'll update the code to also fix this for mixins.
cc4a303 to
dbd9a3b
Compare
The CEM analyzer's inheritance resolution overwrites subclass @type JSDoc overrides with the base mixin's generic type (e.g., Object from I18nMixin). Add a two-phase plugin that collects @type overrides from getter declarations during analyzePhase and re-applies them in packageLinkPhase after inheritance resolution, using BFS to ensure the closest (most specific) override wins. Apply overrides to all declarations (classes and mixins) and update both member and attribute types for consistency. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dbd9a3b to
e1ecc47
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Depends on #11381
@typeJSDoc overrides with the base mixin's generic type (e.g.,ObjectfromI18nMixin), even when a subclass getter has a more specific@typelike@type {!AppLayoutI18n}@typeoverrides from getter declarations duringanalyzePhase, then re-applies them inpackageLinkPhaseafter CEM's own inheritance resolution has runfindClassNodehelper that handles both class declarations and mixin patterns (including two-argument patterns likeI18nMixin(defaultI18n, superClass)thatextractMixinNodescannot handle)getJsDocTagshelper reused acrossmixesPlugin,typeOverridePlugin, andclassPrivacyPluginTest plan
yarn release:cemand verify no errorsObject:packages/app-layout/custom-elements.json—AppLayout.i18nshould have typeAppLayoutI18npackages/date-picker/custom-elements.json—DatePicker.i18nshould have typeDatePickerI18npackages/crud/custom-elements.json—Crud.i18nshould have typeCrudI18n🤖 Generated with Claude Code