Error TS2554 in *.directive.spec.ts

This is basic coding.

Here is your class signature :

constructor(private el: ElementRef,private titleService: Title) {}

Here is how you create it :

const directive = new HeadTitleDirective();

Do yo usee the issue there ?

To resolve it, simply create mocks of your dependencies.

let elRefMock = {
  nativeElement: document.createElement('div')
};

let serviceMock = {
  setTitle: (title: string) => null
};

const directive = new HeadTitleDirective(elRefMock, serviceMock);

I also dont fully understand why this error happens, but it works by setting the directive type directly to directive const in your specs.ts

import { HeadTitleDirective } from './head-title.directive';

describe('HeadTitleDirective', () => {
  it('should create an instance', () => {
    const directive = HeadTitleDirective;
    expect(directive).toBeTruthy();
  });
});