0

While trying to push data from the input to output, through push event, the parameter passed is showing error

Code

Sahana S
  • 27
  • 3
  • declare the post as:`storePost:any[]=[]`. BTW, please, don't post code as images. Copy the code, select it and use CTRL+K to show formatted in the question. If you use an image you force to click the link, if the image is loosed the question is unintelligible, it's not accessible,...) – Eliseo Mar 28 '23 at 06:19
  • Please post code, not pictures of code ... – derpirscher Mar 28 '23 at 06:19
  • Does this answer your question? [What is "not assignable to parameter of type never" error in TypeScript?](https://stackoverflow.com/questions/52423842/what-is-not-assignable-to-parameter-of-type-never-error-in-typescript) – Andrew Allen Apr 02 '23 at 14:27

2 Answers2

1

It is not preferrable to use any. Instead of that make an interface and import that interface and use it. For example

  public storedPosts: Post[] = [];

If you have any doubt creating the interface do let me know.

0

You should declare the type of your array.

Something like that if you're using any: storedPosts: any[] = [];

Timmy
  • 4,098
  • 2
  • 14
  • 34
dunivivi
  • 1
  • 3