refactor(compiler-cli): move DelegatingPerfRecorder initialization into constructor#54834
refactor(compiler-cli): move DelegatingPerfRecorder initialization into constructor#54834frost-cy wants to merge 1 commit intoangular:mainfrom
Conversation
There was a problem hiding this comment.
this.perfRecorder gets set through get perfRecorder()
There was a problem hiding this comment.
However, the livePerfRecorder in the get perfRecorder() doesn't get set until the constructor runs.
This causes a runtime error.
devversion
left a comment
There was a problem hiding this comment.
Our code-base in general may not be compliant with useDefineForClassFields = true. Is this the only instance you saw in G3? — we might need to switch to that as well.
We are explicitly setting useDefineForClassFields = false in our builds
There are more cases in g3 where it's a TS error - This |
|
@frost-cy Maybe we should chat more about the effort and how Angular can be compliant? We don't have any testing in 3P to verify that the sources are compilable with |
|
@frost-cy Can you please rename the commit message as well? Right now, only the PR title is updated. |
…to constructor Move the initialization of class field `DelegatingPerfRecorder` into the constructor. This fixes the error : `TypeError: Cannot read properties of undefined (reading 'eventCount')` This is blocking the roll-out of public class.
|
This PR was merged into the repository by commit b961075. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
When TS output target is set to ES2022 or newer, the class fields don't get transpiled.
That causes a runtime error here in the
DelegatingPerfRecorder.This is because
delegatingPerfRecorderthat gets initialized here passesthis.perfRecorderas argument. However,this.perfRecorderdoesn't get set until the NgCompiler constructor runs.PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
no change in the behavior
Issue Number: N/A
What is the new behavior?
no change in the behavior
Does this PR introduce a breaking change?
Other information