ts-node中Parameter 'xxx' implicitly has an 'any' type.

2021-01-08 16:53:12

在typescript的编译过程中,函数的参数被提示 {变量名} implicitly has an 'any' type,但是我也不知道应该指明他为什么类型的参数,我知道可以关闭这个校验规则,其他的还有别的解决办法吗?PS我是react,使用了箭头函数。

有两种解决办法

  1. 佛系解决 


    tsconfig.json添加"noImplicitAny": false,

    或者 "strict": true,改为false

  2. 一般佛西解决

    {x:any}


    我不知道它具体是什么,但它一定有某某属性:用字面量声明类型,{ x: string }

    我不确定它有什么属性,之后我会用if再仔细判断:声明为unknown类型

    我自己有数,你别管了:声明为any类型

  • 2017-02-13 17:50:05

    cURL error 60: SSL certificate problem: unable to get local issuer certificate

    Drupal 8 version uses Guzzle Http Client internally, but under the hood it may use cURL or PHP internals. If you installed PHP cURL on your PHP server it typically uses cURL and you may see an exception with error Peer certificate cannot be authenticated with known CA certificates or error code CURLE_SSL_CACERT (60).

  • 2017-02-16 08:09:01

    HTML中PRE和p的区别

    pre 元素可定义预格式化的文本。被包围在 pre 元素中的文本通常会保留空格和换行符。而文本也会呈现为等宽字体。 <pre> 标签的一个常见应用就是用来表示计算机的源代码。

  • 2017-02-16 15:14:14

    动态加载js和css

    开发过程中经常需要动态加载js和css,今天特意总结了一下常用的方法。