mox*_*cat 7 javascript visual-studio-code
我想在引用库时隐藏“导入”,即本地/全局导入,正常使用库的内容\n可以实现吗,还是已经实现了?
\n我在插件加载器中使用这些代码,因此我不需要导入它。它\xe2\x80\x99只是一个提示查看注释的工具。
\n我正在使用 VSCODE 及其内置 JavaScript
\n例子:
\nimport { mc } from "./Libary/Game/Player";\n\nmc.runcmd('kill u m')\n
Run Code Online (Sandbox Code Playgroud)\n想要使用:
\nmc.runcmd('kill u m')\n
Run Code Online (Sandbox Code Playgroud)\n并且还可以看到注释和函数类型等。
\n通过在文件中声明库的 API并在项目的根目录中.d.ts
设置,VSCode 将自动在全局范围内包含这些定义。jsconfig.json
这是一个示例存储库,其功能用法为mc.runcmd
:https://github.dev/david-shortman/vscode-javascript-how-to-implicit-import-library
有关声明文件的更多信息 - https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-d-ts.html
更多信息jsconfig.json
- https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#using-tsconfigjson-or-jsconfigjson
归档时间: |
|
查看次数: |
434 次 |
最近记录: |