Skip to content

Commit f824911

Browse files
dylhunnthePunderWoman
authored andcommitted
fix(compiler): For FatalDiagnosticError, hide the message field without affecting the emit (#55160)
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`. PR Close #55160
1 parent c04ffb1 commit f824911

File tree

1 file changed

+1
-1
lines changed
  • packages/compiler-cli/src/ngtsc/diagnostics/src

1 file changed

+1
-1
lines changed

packages/compiler-cli/src/ngtsc/diagnostics/src/error.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class FatalDiagnosticError extends Error {
2727

2828
// Trying to hide `.message` from `Error` to encourage users to look
2929
// at `diagnosticMessage` instead.
30-
override message: never = this.message;
30+
declare message: never;
3131

3232
/**
3333
* @internal

0 commit comments

Comments
 (0)