ngx-emoji-mart error Property '"x"' is incompatible with index signature

443 Views Asked by At

I've installed in my 15.2.8 angular app the library ngx-emoji-mart from https://www.npmjs.com/package/@types/emoji-mart

I've imported it in the module

import { PickerModule } from '@ctrl/ngx-emoji-mart';

imports: [
...
PickerModule,
...

]

Added it in the component <emoji-mart set="apple" class="emoji-mart"></emoji-mart> And imported the style in the styles.css `@import '@ctrl/ngx-emoji-mart/picker';

The problem is that when I serve it, it gives me a list of error:

Property '"categories"' is incompatible with index signature.
Type '{ alias: "categories"; required: false; }' is not assignable to type 'string'.

Property '"emojis"' is incompatible with index signature.
Type '{ alias: "emojis"; required: false; }' is not assignable to type 'string'.

Property '"skin"' is incompatible with index signature.
Type '{ alias: "skin"; required: false; }' is not assignable to type 'string'.

And so on.

Do you know why it happens and how to fix it? Thank you

1

There are 1 best solutions below

0
On

html:

<emoji-mart (emojiClick)="addEmoji($event)"></emoji-mart>

ts:

public addEmoji(event:any){
console.log(event);
}

in the module file:

import { PickerComponent } from '@ctrl/ngx-emoji-mart';

@NgModule({
   imports: [
   ...,
   PickerComponent,
   ]
})