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

27.png解决方法:

修改 tsconfig.json:

image.png

将下列参数改成 false 即可:

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

问题解决:

28.png

目录
相关文章
|
9月前
Cannot read properties of undefined (reading ‘resetFields‘)“
Cannot read properties of undefined (reading ‘resetFields‘)“
130 0
|
29天前
|
缓存 JavaScript
报错:cannot read properties of undefined “reading url“
报错:cannot read properties of undefined “reading url“
|
1月前
|
数据库
Field ‘xxx‘ doesn‘t have a default value
Field ‘xxx‘ doesn‘t have a default value
15 0
|
7月前
Property ‘Authorization‘ does not exist on type ‘HeadersDefaults‘
Property ‘Authorization‘ does not exist on type ‘HeadersDefaults‘
38 0
|
5月前
|
JavaScript API
Property ‘proxy‘ does not exist on type ‘ComponentInternalInstance | null‘.ts
Property ‘proxy‘ does not exist on type ‘ComponentInternalInstance | null‘.ts
|
5月前
|
测试技术
ERROR [karma]_ TypeError_ Cannot read property 'unmask' of undefine
ERROR [karma]_ TypeError_ Cannot read property 'unmask' of undefine
|
1月前
|
JavaScript
Cannot read properties of undefined (reading ‘install‘) TypeError: Cannot read properties of……
Cannot read properties of undefined (reading ‘install‘) TypeError: Cannot read properties of……
|
6月前
|
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
84 0
|
8月前
|
JavaScript
Error TS6138 - Property xxxx is declared but its value is never read
Error TS6138 - Property xxxx is declared but its value is never read
55 0