stack s
stack s

Reputation: 119

Argument of type 'EventTypes' is not assignable to parameter of type string

I'm trying to add types to the below function,

  clickEvent(event:Event) {
    this.event = event
  }

HTML

<a [href]="href" [target]="target" (click)="clickEvent('text')"></a>

Types

export interface EventTypes {
  click?: string;
  load?: string;
  link?: string;
}

When I assign the types to clickEvent, I'm getting this error on event

[ts] Argument of type 'EventTypes' is not assignable to parameter of type 'string'. [2345]

Please tell me what I'm doing wrong here.

Upvotes: 0

Views: 990

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222722

The problem is with your tagLink method in your service. Method definitions looks like it only accepts string, but you are passing a variable of type EventTypes

this.informationTaggingService.tagLink('onclick', this.text, z_eventType, 
                                                             ^^^^^^^^^^

Upvotes: 0

Related Questions