-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add vertex class for javascript and typescript #370
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Hi @zhuoqinyue ! The Vertex class is used for the adjacency list implementation. Could you update the |
OK. But there will cause a problem when I write the code of Do you think this problem has a big impact? |
Yes. We'd better solve this. @justin-tse How do you think about it? |
I have a opinion that we don't have to update the |
Yes. But it is not elegant because we will make a twin class. Is there an entry point check in JS and TS? Like
|
It seems there no such method. |
emm... One more solution. |
Better but not enough elegant haha! |
I've updated the |
@zhuoqinyue Thank you for the clear codes. @krahets I think we can use require.main to solve this problem? |
@zhuoqinyue, I am using ts-node to test my .ts file and it seems to be working well. However, I'm curious to know what kind of problems you are experiencing. |
The result tell me that |
Yes, I think you should install @types/node, and try it. |
@zhuoqinyue Good job! I think you misunderstand my meaning that I install ts-node in global but install @types/node in the devDependencies because it is only used in our local project. Your warning message tells you what to do. |
Could you tell me your config about |
Fine. I found my fault. |
OK, I think we don't push node_modules and package.json to this repository. These files are a little related to this project but are too big. You could give a comment before the line // need to add the package @types/node contains type definitions for Node.js, npm i --save-dev @types/node
if (require.main === module) |
I've updated it. @justin-tse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!@zhuoqinyue Clear codes! My suggestions to use explicit types or implicit types are:
It's generally a good practice to use explicit types for function parameters and return types, as well as for variables that can be of more than one type. However, for variables that can only have one type and where the type is clear from the value, implicit typing is often sufficient.
OK, I've updated it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!@zhuoqinyue
If this PR is related to coding or code translation, please read the contribution guideline, fill out the checklist, and paste the console outputs to the PR.