“Property ‘data’ is incompatible with index signature.”

huangapple go评论68阅读模式
英文:

Property "data" is incompatible with index signature

问题

I am trying to use markdown which is giving data binding error. The datatype of [data] in my markdownComponent.d.ts file is 'string | undefined | null' but still gives error "Can't bind to 'data' since it isn't a known property of 'markdown'."

error in ecmp of markdown.component.d.ts

error: Can't bind to 'data' since it isn't a known property of 'markdown'.

error in markdownComponent.d.ts file

markdownContent is of type string and initialized

I dont understand the problem ... data and markdownContent both are of type: string then why markdownContent can not be assigned to [data]? i've imported all required modules i.e. FormsModule , ReactiveModule, ngx-markdown ...also while running command 'npm i --force ngx-markdown' i got an error that "marked" does not exist so i installed "marked" and imported it in markdownComponent.d.ts the "marked" error was resolved but still im getting error in ecmp .

I want to assign [data]="markdownContent"

英文:

I am trying to use markdown which is giving data binding error. The datatype of [data] in my markdownComponent.d.ts file is 'string |undefined|null' but still gives error " Can't bind to 'data' since it isn't a known property of 'markdown'."

error in ecmp of markdown.component.d.ts

error: Can't bind to 'data' since it isn't a known property of 'markdown'.

error in markdownComponent.d.ts file

markdownContent is of type string and initialized

I dont understand the problem ... data and markdownContent both are of type: string then why markdownContent can not be assigned to [data]? i've imported all required modules i.e. FormsModule , ReactiveModule, ngx-markdown ...also while running command 'npm i --force ngx-markdown' i got an error that "marked" does not exist so i installed "marked" and imported it in markdownComponent.d.ts the "marked" error was resolved but still im getting error in ecmp .

I want to assign [data]="markdownContent"

答案1

得分: 2

我在尝试在 Angular 15 中使用 ngx-markdown@16.0.0 时遇到了相同的问题。

降级到 ngx-markdown@15.1.2 修复了它。

英文:

I had the same issue while trying to use ngx-markdown@16.0.0 with angular 15

Downgrading to ngx-markdown@15.1.2 fixed it

huangapple
  • 本文由 发表于 2023年5月29日 14:41:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/76355163.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定