dsherret / dsherret/ts-morph

How to compile with extending angular component

Open
#1,353 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
6.2k
Forks
238
Avg merge
2m
Merged PRs (30d)
1

Description

Hello,

I want to compile custom class with extending an angular component.

For example this is my angular angular component : src/app/shared/components/application/test/test.component.ts

I have a class like this. It extends TestComponent. I want to compile this but it gives Cannot find name 'TestComponent' as normal.
How i can import this Test Component into this?

I want to compile this ts to js and load it dynamiclly to TestComponent to extend angular component's functionality at runtime with custom code.

Code to compile:
compileRequest.CustomCode += "module com.test.dp.application {\n";
compileRequest.CustomCode += "export class CustomApp1 extends TestComponent { \n";
compileRequest.CustomCode += " public modelChanged(newObj) { \n";
compileRequest.CustomCode += " alert('test1');\n";
compileRequest.CustomCode += " } \n";
compileRequest.CustomCode += " } \n";
compileRequest.CustomCode += " } \n";

Thank you!

Contributor guide

Open the contributing guide

Research direction

Begin with src/app/shared/components/application/test/test.component.ts and the generated CustomCode shown in the report; verify how the custom class is expected to resolve TestComponent before attempting compilation. Done means a documented or reproducible path that compiles the TypeScript and loads the resulting class dynamically, or a clear limitation if this is unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
compilers, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.