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

stockCode: string = 'IBM';

tslint觉得根据'IBM'判断出stockCode的类型是string,所以再写成string类型是多此一举。

那么怎么去掉这条规则呢?

ctrl+shift+p搜索tslint,选择TSLint:Create a 'tslint.json' file

将:

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

改成:

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

Type string trivially inferred from a string literal, remove type annotation相关推荐

  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.eslint@typescript-eslin

    TypeScript代码类似: const web: string = "Hello World"; 如果是用eslint 验证会导致报错 Type string triviall ...

  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. MySQL01-安装mysql数据库
  2. Scrapy_splash组件的使用
  3. 聊一聊多源最短路径问题(只有5行代码哦)
  4. 数学建模学习笔记——模糊综合评价模型(评价类,发放问卷一般不用)
  5. java结构化语言,如何让Java代码流畅和结构化
  6. 刚刚,阿里云知行动手实验室正式开放公测了
  7. 【开发管理类软件必备知识视频教程之二】登录窗体后台注意事项
  8. 使用VS开发C++ 控制台程序或其他项目出现 ‘ LINK : fatal error LNK1104: 无法打开文件“LIBCD.lib” ’ 常规解决办法
  9. 关于使用百度地图的总结
  10. httppostedfilebase.saveas后文件被占用_文件过多时ls命令为什么会卡住?
  11. Java Redis 做分布式锁
  12. yii2 html转换,能够将yii2的api以html文件导出,以及相关的测试
  13. Mac技巧,更改Mac桌面图片
  14. 十、线程(11 章)
  15. android的热修复,Android热修复之
  16. 物联网行业解决方案之智慧畜牧
  17. Android Proguard 不混淆所有第三方jar(忽略配置设置)
  18. .obj文件格式与.mtl文件格式(转)
  19. 计算机运用基础 南开在线作业,《大学计算机基础》20秋南开在线作业百分
  20. 使用指针实现strcpy函数的功能

热门文章

  1. DELL r340服务器U盘安装Centos7
  2. vue 高德地图 不同区域显示不同颜色_高德地图这样用成为你的图表神器
  3. python 百分号调用内置函数_打牢Python基础这12类内置函数你掌握了吗
  4. jmeter分布式操作之远程启动功能
  5. java毕业设计——基于Java+AI的五子棋游戏设计与实现(毕业论文+程序源码)——五子棋游戏
  6. 13.爬虫训练场集成文件采集案例,来学习一下怎么实现的
  7. cmd脚本(WIN10下)
  8. opencv实战从0到N (14)- 凸包算法 convexity defects
  9. vivoy85a参数配置_vivoY85A基本配置参数?
  10. 高项_第十二章项目采购管理