refactor: enhance type safety and structure in AST handling#2214
Merged
Patryk Tomczyk (patzick) merged 5 commits intomainfrom Jan 19, 2026
Merged
refactor: enhance type safety and structure in AST handling#2214Patryk Tomczyk (patzick) merged 5 commits intomainfrom
Patryk Tomczyk (patzick) merged 5 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request enhances type safety in the @shopware/cms-base-layer package by adding comprehensive TypeScript types to the html-to-vue helper functions. The refactor removes @ts-nocheck directives and introduces strongly-typed interfaces for AST parsing, traversal, and rendering logic.
Key changes:
- Added TypeScript type definitions (ASTNode, VisitCallback, ExtraComponentConfig, RendererConfig, etc.) across ast.ts and renderer.ts
- Refactored renderer logic with new
flattenChildrenutility for child node normalization - Updated type guards and function signatures for safer AST manipulation with explicit typing
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cms-base-layer/app/helpers/html-to-vue/renderer.ts | Added comprehensive TypeScript types, introduced flattenChildren function, refactored renderer with explicit typing |
| packages/cms-base-layer/app/helpers/html-to-vue/ast.ts | Added type definitions for AST operations, improved type guards in isNode, enhanced _visitAST with proper typing |
| packages/cms-base-layer/app/helpers/html-to-vue/renderToHtml.ts | Updated to use new RendererConfig and RectifyConfig types from refactored modules |
| packages/cms-base-layer/app/helpers/html-to-vue/getOptionsFromNode.ts | Exported Options type for cross-module type consistency |
| packages/cms-base-layer/app/components/public/cms/element/CmsElementText.vue | Fixed boolean conversion in conditions function to align with TypeScript typing |
| .changeset/light-dragons-lie.md | Added changeset entry documenting the TypeScript typing additions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Patryk Tomczyk (patzick)
approved these changes
Jan 19, 2026
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.
This pull request introduces full TypeScript to the
html-to-vuehelper functions in the@shopware/cms-base-layerpackage. The main focus is on improving type safety and code clarity across the AST parsing, traversal, and rendering logic. The changes include adding and refining TypeScript types, updating function signatures, and refactoring internal logic to leverage these types.TypeScript Typing and Type Safety Improvements:
ASTNode,VisitCallback,ExtraComponentConfig, etc.) toast.tsandrenderer.ts, replacing//@ts-nocheckand ensuring all functions and parameters are strongly typed. [1] [2]isNode,generateAST, andrectifyASTfunctions to use explicit types and improved type guards for safer AST manipulation. [1] [2]Optionstype fromgetOptionsFromNode.tsfor consistent usage across modules.Renderer Refactoring and Type Integration:
rendererfunction and its internal logic to use the new types, addedflattenChildrenfor child normalization, and improved handling of extra component renderers and children arrays. [1] [2] [3]Documentation and Minor Improvements:
(References: [1] [2] [3] [4] [5] [6] [7]
closes #1088