[英]In Typescript, is there a way to make function parameters typing mandatory
I'm working on a big project with JS and TS files and sometimes there are no types on Typescript functions.我正在处理一个带有 JS 和 TS 文件的大型项目,有时 Typescript 函数上没有类型。
Since we want to use typescript to type things I would like to have a way to make function parameters mandatory with typescript CLI or ESLint, is this possible?由于我们想使用 typescript 来输入内容,我想有一种方法使 function 参数强制使用 typescript CLI 或 ESLint,这可能吗?
Did not find anything on it.没有找到任何东西。
TSConfig option noImplicitAny
will ensure that parameters are specified and not assumed to be any
. TSConfig 选项
noImplicitAny
将确保指定参数并且不假定为any
。
noImplicitReturns
will also help for return types. noImplicitReturns
也将有助于返回类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.