Angular TS → JS Migration Rules
When migrating .ts (Angular) components to .js:
- Remove all Angular imports, decorators (
@Component,@Input), and TypeScript types - Remove interfaces and type annotations
- Remove all Angular lifecycle interfaces
- For simple fields components extend
FieldBaseComponentif possible and reasonable. - For Container components extend
ContainerBaseComponentif possible and reasonable. - For rest of components extend
BaseComponent ngOnInit→init()withcomponentsManager.onComponentAdded(this)ngOnDestroy→destroy()withsuper.destroy()andcomponentsManager.onComponentRemoved(this)- Merge
onStateChangeintocheckAndUpdate() updateSelf→#updateSelf()(private); add#sendPropsUpdate()at end- Add
update(pConn, ...)method for external re-rendering - Replace
this.pConn$→this.pConn; remove allas anycasts - Normalize quotes to double quotes
- If there is some external dependency try to look in additional provided ts files and copy its content to migrated js. If nothing is found try to find existing equivalent in js files or create mocked implementation.
- When migrating parts of code prefer copy-paste over code modification.
- Never change logic of migrated components.
- In sdk-pega-component-map.js uncomment migrated component entry in pegaSdkComponentMap and also import line. Fix imported component path.