-
Notifications
You must be signed in to change notification settings - Fork 664
[FR] TypeScript support for leetcode's built-in data structures 力扣自定义数据结构(如ListNode、TreeNode)的TypeScript支持 #828
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
Comments
I've made my solution for this feature. Here is the solution repo: I'm also trying to make it easier to use, with less extra code. Here is my new idea and PR. But the simple |
翻了一下issue,发现中国用户比较多,外加LeetCode-OpenSource组织位于中国上海,那我也就不强行用我这塑料英语交流了。 简单说下前面的Feature Proposal部分,就是对于习惯使用JavaScript/TypeScript解题的用户提供一些力扣内置数据结构的类型定义。比如 为什么有这种想法呢?因为在线的编辑器里对 然后这个issue迟迟没有人回应,于是我做了自己的解决方案,代码仓库是这个: 然后我自己用得还是不太爽,今天又搞了个解析示例测试用例的parser,写了demo还给自己提了PR: 但是这parser显然没什么必要,力扣官方肯定有更好的解析用例输入和输出的方法。作为程序员,软件用不爽就会想去hack一些自定义的东西,直到软件本身真正满足了需求。我这么搞真的很浪费时间,希望官方能有更好的方案。 |
多造一点假的回复是不是就会有人来看呢? |
感觉这个 repo 是不是没人维护了...快一年没有 commit 了, pr 和 issue 也有一堆 open 的 |
I am having this issue in Java language too. VSCode is not able to recognize the ListNode data structure built in and fails to provide basic features like code formatting and suggestions for the code. |
🚀 Feature Proposal
Add
TypeScript
type declaration file of leetcode's built-in data structures to the workspace root (such as~/.leetcode
) automatically when users open a leetcode workspace with languagetypescript
.Motivation
The online editor has correct type inference of leetcode's built-in data structure, such as
TreeNode
andListNode
. It's reasonable to have the same experience with thisvscode
extension.Contribution
I think there already exists a
TypeScript
declaration file for those built-in data structures for the online editor. Just create a copy of that file viavscode.workspace.fs.writeFile
when users open a leetcode workspace with languagetypescript
. Also create atsconfig.json
file if necessary, or just executenpx tsc --init
.More
Support running
JavaScript
/TypeScript
test cases locally, sincenodejs 10+
is required for this extension, possibly by usingbabel
to transpileTypeScript
code toJavaScript
code and callingnodejs
API likevm.runInContext
to execute theJavaScript
code.The text was updated successfully, but these errors were encountered: