智能客服
你问我答,随时在线为你解决问题
不允许使用“any”类型。
该规则仅支持对.js/.ts文件进行检查。
- // code-linter.json5
- {
- "rules": {
- "@typescript-eslint/no-explicit-any": "error"
- }
- }
- export const age1 = 17;
- export const age2 = [age1];
- export const age3 = [age1];
-
- export function greet1(): string {
- return 'greet';
- }
-
- export function greet2(): string[] {
- return ['greet'];
- }
-
- export function greet4(): string[][] {
- return [['greet']];
- }
-
- export function greet5(param: readonly string[]): string {
- return param[age1];
- }
-
- export function greet6(param: readonly string[]): string[] {
- return [...param];
- }
- export const age1: any = 17;
- export const age2: any = [age1];
- export const age3: any = [age1];
-
- export function greet1(): any {
- return 'greet';
- }
-
- export function greet2(): any[] {
- return ['greet'];
- }
-
- export function greet4(): any[][] {
- return [['greet']];
- }
-
- export function greet5(param: readonly any[]): any {
- return param[age1];
- }
-
- export function greet6(param: readonly any[]): any[] {
- return [...param];
- }
- plugin:@typescript-eslint/recommended
- plugin:@typescript-eslint/all
Code Linter代码检查规则的配置指导请参考Code Linter代码检查。
智能客服
你问我答,随时在线为你解决问题
合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
解决方案
精准高效的一站式服务支持,助力开发者商业成功