Skip to content

Commit

Permalink
refactor(docs-infra): use standard ECMAScript decorators
Browse files Browse the repository at this point in the history
There was only one usage of experimental decorators present in the code.
This `@Inject` parameter decorator was replaced with `inject()`. This allows
for the removal of the TypeScript `experimentalDecorators` option from the build.
This change also has the benefit of ensuring that `@Inject` usage is not
accidently introduced within the code since `inject()` is otherwise used
throughout.
  • Loading branch information
clydin committed Jun 4, 2024
1 parent 9e21582 commit 6eacb58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 5 additions & 7 deletions adev/src/app/core/services/errors-handling/error-snack-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/

import {ChangeDetectionStrategy, Component, Inject} from '@angular/core';
import {ChangeDetectionStrategy, Component, inject} from '@angular/core';
import {MAT_SNACK_BAR_DATA, MatSnackBarAction, MatSnackBarRef} from '@angular/material/snack-bar';

export interface ErrorSnackBarData {
Expand Down Expand Up @@ -36,12 +36,10 @@ export interface ErrorSnackBarData {
export class ErrorSnackBar {
protected message: string;
protected actionText?: string;
data: ErrorSnackBarData = inject(MAT_SNACK_BAR_DATA);

constructor(
protected snackBarRef: MatSnackBarRef<ErrorSnackBar>,
@Inject(MAT_SNACK_BAR_DATA) public data: ErrorSnackBarData,
) {
this.message = data.message;
this.actionText = data.actionText;
constructor(protected snackBarRef: MatSnackBarRef<ErrorSnackBar>) {
this.message = this.data.message;
this.actionText = this.data.actionText;
}
}
2 changes: 0 additions & 2 deletions adev/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "ES2022",
Expand Down

0 comments on commit 6eacb58

Please sign in to comment.