【问题标题】:Javascript Intellisense not working for functional parameters [closed]Javascript Intellisense 不适用于功能参数 [关闭]
【发布时间】:2021-09-11 00:34:39
【问题描述】:

每当我将一些参数传递给另一个文件中的函数时,Intellisense 就会停止工作。

【问题讨论】:

    标签: javascript visual-studio-code vscode-settings intellisense javascript-intellisense


    【解决方案1】:

    您需要定义您的智能感知 - 在这种情况下,没有定义或强制执行 initiatedBy 需要的类型。它应该User,但这不是强制的,所以类型是any

    要在 VSCode 中定义类型,请使用双星号注释:

    /**
      * What your function does should be here.
      * @param {this should be the type of your param} nameOfParameter
      * @param {Discord.User} initiatedBy
      * @return {return type}
      */
    const mainCreator = async (client, serverId, requestedUser, initiatedBy) => {}
    

    请注意,这不会强制执行任何类型检查,它只会更新智能感知。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-08-28
      • 2016-11-06
      • 2022-11-17
      • 2016-07-14
      • 2018-07-19
      • 2021-03-28
      • 1970-01-01
      相关资源
      最近更新 更多