Error TS6138 - Property xxxx is declared but its value is never read

简介: Error TS6138 - Property xxxx is declared but its value is never read

我有一段 TypeScript 代码:

export class AppModule {
  constructor(private s: ActiveCartService){
    if( s === undefined){
      console.log(s);
    }
    s.isStable().subscribe((data) => console.log('isStable: ' , data));
  }
}

引起如下错误消息:

Error TS6138 - Property xxxx is declared but its value is never read

解决方法:

修改 tsconfig.json:

将下列参数改成 false 即可:

"noUnusedLocals": false,
 "noUnusedParameters": false,

问题解决:

相关文章
|
8月前
Cannot read properties of undefined (reading ‘resetFields‘)“
Cannot read properties of undefined (reading ‘resetFields‘)“
128 0
|
3月前
|
SQL IDE Java
hibernate5 Cannot create TypedQuery for query with more than one return using requested result type
hibernate5 Cannot create TypedQuery for query with more than one return using requested result type
22 0
|
5天前
|
索引
Elasticsearch exception [type=illegal_argument_exception, reason=index [.1] is the write index for data stream [slowlog] and cannot be deleted]
在 Elasticsearch 中,你尝试删除的索引是一个数据流(data stream)的一部分,而且是数据流的写入索引(write index),因此无法直接删除它。为了解决这个问题,你可以按照以下步骤进行操作:
|
27天前
|
数据库
Field ‘xxx‘ doesn‘t have a default value
Field ‘xxx‘ doesn‘t have a default value
14 0
|
6月前
Property ‘Authorization‘ does not exist on type ‘HeadersDefaults‘
Property ‘Authorization‘ does not exist on type ‘HeadersDefaults‘
38 0
|
4月前
|
JavaScript API
Property ‘proxy‘ does not exist on type ‘ComponentInternalInstance | null‘.ts
Property ‘proxy‘ does not exist on type ‘ComponentInternalInstance | null‘.ts
|
4月前
|
测试技术
ERROR [karma]_ TypeError_ Cannot read property 'unmask' of undefine
ERROR [karma]_ TypeError_ Cannot read property 'unmask' of undefine
|
5月前
|
JavaScript
TypeError: Cannot read properties of null (reading 'level')
# 一、分析问题 1、一个下拉框组件的更新由另一个下拉框组件控制被动更新列表,子级下拉框的值是由父级下拉框的值调用接口获取,每次父级下拉框值的改变都会改变子级下拉框的数据源也就是会改变子级下拉框的options,切换后之前的父级节点找不到就会报了这个错,父级节点不改变(即不切换)的话不会报错 # 二、解决方案 ## 1、vue页面的html层 ```html <div> <el-row :gutter="15"> <el-col :span="4"> <div">父级下拉框:</div> <el-select clearable v-model="parentId" @c
78 0
Error TS6138 - Property xxxx is declared but its value is never read
Error TS6138 - Property xxxx is declared but its value is never read
166 0
Error TS6138 - Property xxxx is declared but its value is never read