Skip to content

Conversation

@mdanilowicz
Copy link
Contributor

This pull request introduces full TypeScript to the html-to-vue helper functions in the @shopware/cms-base-layer package. 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:

  • Added comprehensive TypeScript types (ASTNode, VisitCallback, ExtraComponentConfig, etc.) to ast.ts and renderer.ts, replacing //@ts-nocheck and ensuring all functions and parameters are strongly typed. [1] [2]
  • Updated the isNode, generateAST, and rectifyAST functions to use explicit types and improved type guards for safer AST manipulation. [1] [2]
  • Exported the Options type from getOptionsFromNode.ts for consistent usage across modules.

Renderer Refactoring and Type Integration:

  • Refactored the renderer function and its internal logic to use the new types, added flattenChildren for child normalization, and improved handling of extra component renderers and children arrays. [1] [2] [3]

Documentation and Minor Improvements:

  • Improved function documentation and parameter descriptions to reflect new typings and clarify usage.

(References: [1] [2] [3] [4] [5] [6] [7]

closes #1088

@vercel
Copy link

vercel bot commented Jan 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
frontends-starter-template-extended Ready Ready Preview, Comment Jan 8, 2026 8:07pm
frontends-vue-starter-template Building Building Preview, Comment Jan 8, 2026 8:07pm
old-frontends-demo Building Building Preview, Comment Jan 8, 2026 8:07pm
1 Skipped Deployment
Project Deployment Review Updated (UTC)
shopware-frontends-docs Skipped Skipped Comment Jan 8, 2026 8:07pm

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 flattenChildren utility 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] replace / refactor html-to-vue internal helper of cms-base package

2 participants