Brakebein / ngx-tagify

Angular library that wraps https://github.com/yaireo/tagify/
MIT License
26 stars 4 forks source link

Example not running. #31

Closed sssrit closed 1 month ago

sssrit commented 2 years ago

I am getting the following issue. while running the code.


[{
    "resource": "/f:/Development/learn angular/tag-app/src/app/app.component.html",
    "owner": "_generated_diagnostic_collection_name_#3",
    "code": "2322",
    "severity": 8,
    "message": "Type 'TagifySettings<UserTag>' is not assignable to type 'TagifySettings<TagData>'.\n  Types of property 'templates' are incompatible.\n    Type 'Templates<UserTag> | undefined' is not assignable to type 'Templates<TagData> | undefined'.\n      Type 'Templates<UserTag>' is not assignable to type 'Templates<TagData>'.\n        Types of property 'wrapper' are incompatible.\n          Type '((this: Tagify<...>, input: HTMLInputElement | HTMLTextAreaElement, settings: TagifyRuntimeSettings<UserTag>) => string) | undefined' is not assignable to type '((this: Tagify<...>, input: HTMLInputElement | HTMLTextAreaElement, settings: TagifyRuntimeSettings<TagData>) => string) | undefined'.\n            Type '(this: Tagify<...>, input: HTMLInputElement | HTMLTextAreaElement, settings: TagifyRuntimeSettings<UserTag>) => string' is not assignable to type '(this: Tagify<...>, input: HTMLInputElement | HTMLTextAreaElement, settings: TagifyRuntimeSettings<TagData>) => string'.\n              The 'this' types of each signature are incompatible.\n                Type 'Tagify<TagData>' is not assignable to type 'Tagify<UserTag>'.\n                  The types of 'settings.templates.wrapper' are incompatible between these types.\n                    Type '(this: Tagify<...>, input: HTMLInputElement | HTMLTextAreaElement, settings: TagifyRuntimeSettings<TagData>) => string' is not assignable to type '(this: Tagify<...>, input: HTMLInputElement | HTMLTextAreaElement, settings: TagifyRuntimeSettings<UserTag>) => string'.\n                      The 'this' types of each signature are incompatible.\n                        Type 'Tagify<UserTag>' is not assignable to type 'Tagify<TagData>'.\n                          The types of 'settings.templates.tag' are incompatible between these types.\n                            Type '(this: Tagify<UserTag>, tagData: UserTag, tagify: Tagify<UserTag>) => string' is not assignable to type '(this: Tagify<TagData>, tagData: TagData, tagify: Tagify<TagData>) => string'.\n                              Types of parameters 'tagData' and 'tagData' are incompatible.\n                                Type 'TagData' is not assignable to type 'UserTag'.",
    "source": "ngtsc",
    "startLineNumber": 4,
    "startColumn": 12,
    "endLineNumber": 4,
    "endColumn": 20,
    "relatedInformation": [
        {
            "startLineNumber": 8,
            "startColumn": 74,
            "endLineNumber": 8,
            "endColumn": 96,
            "message": "Error occurs in the template of component AppComponent.",
            "resource": "/f:/Development/learn angular/tag-app/src/app/app.component.ts"
        }
    ]
}]

Please help on this issue.
Brakebein commented 2 years ago

Can you please provide some code snippets?

sssrit commented 2 years ago

I am using this example. https://github.com/Brakebein/ngx-tagify/tree/master/src/app/example-templates

Brakebein commented 2 years ago

The example code works as expected. Since the error occurs in your app.component.ts, it seems that you copied the code and maybe did some small changes. It looks like that the interface UserTag is not provided for a generic at some point. Would still be good to have a look at your code.