How to force all variables in Typescript to have a type declared

后端 未结 2 1050
执笔经年
执笔经年 2021-02-12 09:54

I understand that when you declare a variable in Typescript, you can choose whether or not to specify a type for the variable. If no type is specified, the default \"any\" type

2条回答
  •  面向向阳花
    2021-02-12 10:28

    You could also set in your tsconfig.json:

    {
      "compilerOptions": {
         "noImplicitReturns": true,
         "noImplicitAny": true
      }
    }
    

提交回复
热议问题