Skip to content

fix(compiler): For FatalDiagnosticError, hide the message field without affecting the emit#55160

Closed
dylhunn wants to merge 1 commit intoangular:mainfrom
dylhunn:fix-error-override
Closed

fix(compiler): For FatalDiagnosticError, hide the message field without affecting the emit#55160
dylhunn wants to merge 1 commit intoangular:mainfrom
dylhunn:fix-error-override

Conversation

@dylhunn
Copy link
Contributor

@dylhunn dylhunn commented Apr 1, 2024

We want to hide .message from users, but the previous approach is not compatible with a specific TS 3.7 flag ("using class fields to specialize properties from base classes also won’t work"). I received a request from the g3 TS team to fix this, so they can enable that flag.

Instead, we just override message to never in the .d.ts using declare.

@dylhunn dylhunn added area: compiler Issues related to `ngc`, Angular's template compiler core: error handling target: minor This PR is targeted for the next minor release labels Apr 1, 2024
@ngbot ngbot bot modified the milestone: Backlog Apr 1, 2024
@dylhunn dylhunn force-pushed the fix-error-override branch 2 times, most recently from 90c1e67 to 63c32b5 Compare April 1, 2024 23:23
@dylhunn dylhunn changed the title fix(compiler): For FatalDiagnosticError, inherit the field in the constructor fix(compiler): For FatalDiagnosticError, hide the message field without affecting the emit Apr 1, 2024
…ithout affecting the emit

We want to hide `.message` from users, but the previous approach is not compatible with a specific [TS 3.7 flag](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier) ("using class fields to specialize properties from base classes also won’t work"). I received a request from the TS team to fix this, so they can enable that flag.

Instead, we just override `message` to `never` in the .d.ts using `declare`.
@dylhunn dylhunn force-pushed the fix-error-override branch from 63c32b5 to e0c936f Compare April 1, 2024 23:24
@dylhunn dylhunn requested a review from devversion April 1, 2024 23:28
@dylhunn dylhunn marked this pull request as ready for review April 1, 2024 23:28
Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

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

lgtm— which shows again that we need tests in 1P/3P, if we are trying to roll this out

@dylhunn dylhunn added the action: merge The PR is ready for merge by the caretaker label Apr 2, 2024
@jessicajaniuk
Copy link
Contributor

This PR was merged into the repository by commit f824911.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler core: error handling target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants