Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pushing an item into a sub-array gives error #58984

Closed
1 task done
murugappanrm opened this issue Jun 23, 2024 · 5 comments
Closed
1 task done

Pushing an item into a sub-array gives error #58984

murugappanrm opened this issue Jun 23, 2024 · 5 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@murugappanrm
Copy link

murugappanrm commented Jun 23, 2024

Acknowledgement

  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.

Comment

I am not why i am getting an error when i try to push a new element into sub-array within the main array when it works fine in Javascript. See screencap below:

Screenshot_2

@jcalz
Copy link
Contributor

jcalz commented Jun 23, 2024

This isn't really a place to ask about using TypeScript. You should consider closing this issue and asking your question on Stack Overflow or the TypeScript Discord. Additionally, screenshots aren't a good way to communicate issues you're having with code. You should provide a self-contained plaintext example. But again, not here. Good luck!

@MichalMarsalek
Copy link

Typescript's entire point is to give errors on code that are valid Javascript.

@murugappanrm
Copy link
Author

murugappanrm commented Jun 24, 2024

@jcalz Very interesting answer. I thought we could address it here when there is a github repo on the source code of typescript and the repo also allows for issues. Perhaps i have been mislead as usual. Never mind.

@MichalMarsalek thank you for being helpful. Unfortunately there is no error in the code. I checked out the DISCORD and the STACK Overflow and they all state the code is correct, including Typescript documentation. Only that realized that validator codes themselves can have errors and so could Microsoft.

@MichalMarsalek
Copy link

MichalMarsalek commented Jun 24, 2024

@jcalz Very interesting answer. I thought we could address it here when there is a github repo on the source code of typescript and the repo also allows for issues. Perhaps i have been mislead as usual. Never mind.

The issues are for tracking bugs and feature requests for Typescript. Not general questions about how Typescript works.

@MichalMarsalek thank you for being helpful. Unfortunately there is no error in the code. I checked out the DISCORD and the STACK Overflow and they all state the code is correct, including Typescript documentation.

The Property 'push' does not ... is the error in the code.

My comment was a response to

when it works fine in Javascript

Which sounds quite strange because it sounded like you were complaining that ts is giving you an error for something that is valid js - but that's Typescript's job.

@RyanCavanaugh RyanCavanaugh added the Question An issue which isn't directly actionable in code label Jun 24, 2024
@RyanCavanaugh RyanCavanaugh closed this as not planned Won't fix, can't repro, duplicate, stale Jun 24, 2024
@murugappanrm
Copy link
Author

murugappanrm commented Jun 24, 2024

@MichalMarsalek thank you for the update. I have cleared the error. Github Co-pilot resolved it for me and also taught me how vanilla javascript is better and is more reliable. What is my basis? Simple, the code that showed as error in TS worked fine with the JS code generated. That is really odd.

Anyway the subject is closed and Github Co-pilot is the way to go. Thank you for all the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

4 participants