【发布时间】:2021-09-19 04:56:35
【问题描述】:
我对编程非常陌生(特别是在 JS/TS 中),但目前我尝试使用 node.js 进行试验,但有一点我特别不理解 IntelliSense 或VSCode 中的“帮助文本”。
例如,我尝试使用fs.open() 并获得以下帮助文本:
open(path: fs.PathLike, flags: fs.OpenMode, mode: fs.Mode | null | undefined,
callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void
A path to a file. If a URL is provided, it must use the file: protocol.
Asynchronous open(2) - open and possibly create a file.
现在,作为一个新手,我如何知道fs.PathLike 类型的外观或包含的内容?如果我在 node.js 文档中查找此方法,我现在知道 fs.PathLike 类型包括 <string> | <Buffer> | <URL>。啊哈!所以它可以像字符串一样简单的文件路径。
但是有没有什么办法可以直接在 VSCode 中看到这些信息呢? fs.PathLike 或 fs.OpenMode 等是什么意思?
【问题讨论】:
标签: javascript node.js typescript visual-studio-code