Home > Software design >  ESLint Error : Prefer using arrow functions over plain functions prefer-arrow/prefer-arrow-functions
ESLint Error : Prefer using arrow functions over plain functions prefer-arrow/prefer-arrow-functions

Time:01-21

I have these lines of code in one of my files. Running ng lint resulted in error "Prefer using arrow functions over plain functions prefer-arrow/prefer-arrow-functions" where I have the code close(result: any), as shown below.

providers: [
   { provide: MatDialogRef, useValue: { close(result: any): void {} } 
]

How can I rewrite that section to avoid this error. Thank you.

CodePudding user response:

should look like this

useValue: { close: () => {} },

but you can make it a spy, so then you would have an option to assert it

useValue: { close: jasmine.createSpy('dialogClose') },
  •  Tags:  
  • Related