TypeScript代码类似:

const web: string = "Hello World";

如果是用eslint 验证会导致报错

Type string trivially inferred from a string literal, remove type annotation.eslint@typescript-eslint/no-inferrable-types

从字符串文字中简单推断出字符串类型,删除类型注释。eslint @ typescript-eslint / no-inferrable-types
他觉得已经推断出是字符串类型,不需要写了
解决办法:
.eslintrc.js 里面 加上

rules: {"@typescript-eslint/no-inferrable-types": "off" // 关闭类型推断
}

如果是用tslint 验证会导致报错

Type string trivially inferred from a string literal, remove type annotation (no-inferrable-types)。

解决办法:
tslint.json 里面添加"ignore-properties"。

"no-inferrable-types": [true,"ignore-params","ignore-properties"
],

Type string trivially inferred from a string literal, remove type annotation.eslint@typescript-eslin相关推荐

  1. Type number trivially inferred from a number literal, remove type annotation.

    错误场景: vue3 使用 typescript 图片示例: typescript 对代码做了类型推断,num2 不需要再指明number类型. 解决办法一. const num2 = 11 解决办法 ...

  2. Type string trivially inferred from a string literal, remove type annotation

    Angular报错:Type string trivially inferred from a string literal, remove type annotation stockCode: st ...

  3. vue3+typeScript项目运行提示Type string trivially inferred from a string literal, remove type annotatio怎么解决

    原因:项目默认开启了类型推断 解决方法:在eslintrc.js的rules中增加一行"@typescript-eslint/no-inferrable-types" : &quo ...

  4. 方法引用错误:reason: no instance(s) of type variable(s) exist so that String conforms to Person

    当使用方法引用的时候出现reason: no instance(s) of type variable(s) exist so that String conforms to Person的错误,如下 ...

  5. error: cannot use promoted field in struct literal of type [duplicate]

    以下内容转载自 https://stackoverflow.com/questions/60518823/error-cannot-use-promoted-field-in-struct-liter ...

  6. python string转int_Python int与string之间的转化

    温馨提示:本文共747个字,读完预计2分钟. Python源代码: print('=========string 转 int==============') a52 = '12' print('十进制 ...

  7. Redis源码-String:Redis String命令、Redis String存储原理、Redis String三种编码类型、Redis字符串SDS源码解析、Redis String应用场景

    Redis源码-String:Redis String命令.Redis String存储原理.Redis String三种编码类型.Redis字符串SDS源码解析.Redis String应用场景 R ...

  8. URLEncoder.encode(String url)和URLDecoder.decode(String url)

    1.http get请求本身是不支持中文的,例如下面的代码: form表单以Get方式提交 <form action="/jsp/deal.jsp" method=" ...

  9. JSON.parseObject(String str)与JSONObject.parseObject(String str)的区别

    一.首先来说说fastjson fastjson 是一个性能很好的 Java 语言实现的 JSON 解析器和生成器,来自阿里巴巴的工程师开发.其主要特点是: ① 快速:fastjson采用独创的算法, ...

最新文章

  1. Windows上同时安装两个数据库
  2. hadoop整合纪要
  3. pdf 深入理解kotlin协程_Kotlin协程实现原理:挂起与恢复
  4. Cobaltstrike4.0系列教程(一)----简介与安装
  5. lightroom手机版下载_vnc控制手机版下载,vnc控制手机版下载的使用教程
  6. r语言plotmds_多元统计分析R语言建模| 11 多维标度法MDS
  7. opencv函数速查笔记
  8. 微信.gif表情包保存到本地
  9. DPDK 20.11 meson build
  10. 【Serenity BDD】使用ChromeDriver打开Chrome浏览器是弹出“Chrome is being controlled by automated software”提示栏
  11. django之 报错(1146, “Table ‘demo2.web‘ doesn‘t exist“)
  12. picpick设置自动截屏方法
  13. AI+视频技术助力保障校园安全,校园智能安防平台该如何建设?
  14. 认知智能整体技术框架简介介绍
  15. 【Unity】创建一个自己的AR安卓程序
  16. 史上最全测试流程详解----超详细
  17. 美剧中50句经典俚语完美解析
  18. 微信支付—— 扫码支付
  19. 深度解决企业传统办公痛点,华为云桌面使能云上办公!
  20. 独家|GPT-4重要缔造者、OpenAI 首席科学家:人工智能不吃人

热门文章

  1. 分享一个超好用的批量处理PPT与PPTX转换,批量删除某一页PPT,批量DOC转换为DOCX的应用
  2. android studio 横向拖动条,Android HorizontalScrollView内子控件横向拖拽实例代码
  3. word2016 上次启动时失败以安全模式能够解决该问题【office专业版】
  4. 小白笔记——异常处理基础
  5. vs2015启动无法工作,问题事件名称: APPCRASH,故障模块名称: KERNELBASE.dll
  6. “诱饵效应”让用户产生“冲突”营销心理学十大效应 营销值得学
  7. MacOS解压rar文件
  8. 线性代数之特征值与特征向量的求法
  9. CSS 网格 Gird 布局
  10. 一个中东外贸业务员分享的干货