开发过程中出现这个错误是因为Typescript在执行代码检查时在该对象没有定义相应属性,这个错误不致命,遇到该错误有以下几种解决办法。

1,将对象设置成 any

    this.targetArray = this.options.find((item:any) => {return item.articleId == val;});

2,通过字符方式获取对象属性

    this.targetArray = this.options.find((item) => {return item["articleId"] == val;});

3,声明断言,强制执行

    this.targetArray = this.options.find((item) => {return (item as any).articleId == val;});

TypeScript Property ‘XXX‘ does not exist on type ‘never‘.相关推荐

  1. property xxx does not exist on type Object报错

    在TypeScript中如果按JS的方式去获取对象属性,有时会提示形如Property 'xxx' does not exist on type 'Object'的错误.下文代码中的'xxx'替换成你 ...

  2. 完美解决:Property ‘XXX‘ does not exist on type ‘Window‘

    发生情景: 在app中的h5,app注入了全局的window对象和webview里面的页面交互,打包的时候报了错误. 解决方式: 方法一: (window as any).xxx 方法二: decla ...

  3. Property ‘xxx‘ does not exist on type ‘{ xxx(file: any, fileList: any): void;的报错

    关闭tsconfig.json里的"strict",把 true 改为 false 即可

  4. 响应式编程时出现:error TS2339: Property 'debounceTime' does not exist on type 'Observableany'.

    constructor() {this.searchInput.valueChanges//.debounceTime(500) 无法使用.pipe(debounceTime(1000)).subsc ...

  5. Angular响应式开发中报错Property 'map' does not exist on type 'Observable'.引用rxjs也没用。

    Angular响应式开发源代码如下: import { Component, OnInit } from '@angular/core'; import {Observable} from 'rxjs ...

  6. Property ‘next‘ does not exist on type ‘Component<any, {}, any>‘问题的解决方法

    场景:使用antd的Carousel组件时,自定义左右切换按钮,触发组件的next(),prev()方法时报错 错误写法: handleNext(){this.refs.img.next()}< ...

  7. TS2550: Property ‘entries‘ does not exist on type ‘ObjectConstructor‘.

    问题:TS2550: Property 'entries' does not exist on type 'ObjectConstructor'. Do you need to change your ...

  8. Property ‘contentWindow‘ does not exist on type HTMLElement,类型htmlelement上不存在contentwindow属性

    一.问题 Property 'contentWindow' does not exist on type HTMLElement 二.解决方法 /*** Property 'contentWindow ...

  9. Property ngOnInit does not exist on type VisibleFocusDirective

    原因是我把Base focus Directive的OnInit函数删除了: 添加上之后问题消失: 更多Jerry的原创文章,尽在:"汪子熙":

最新文章

  1. 重写 equals 方法就一定要重写 hashCode 方法?其实有个前提
  2. python多线程爬虫实例-python 多线程爬虫 实例
  3. codevs 1082 线段树区间求和
  4. 如何去掉手机php,dedecms怎么关闭手机版
  5. 网络分层模型OSI和TCP/IP四层模型
  6. 将svg文件化成字体图标的步骤
  7. Qt Creator在问题窗格中显示任务列表文件
  8. 2019.01.29【NOIP普及组】模拟赛C组总结
  9. android动态加home,Android 解决监听home键的几种方法
  10. 动态卷积:自适应调整卷积参数,显著提升模型表达能力 CVPR 2020
  11. 安卓Dialog弹出对话框全解:包含了AlertDialog,DialogFragment
  12. hadoop集群免密码登陆
  13. 快二游戏数据分析_1.更快的数据分析
  14. 联想笔记本怎么进入pe系统_联想笔记本电脑怎么进入PE?
  15. 怎么修改PDF文件中的图片以及文字
  16. 前Google工程师Levandowski跳入优步监狱
  17. 基于eigen实现matlab hamming hann blakman 窗函数的实现
  18. iOS苹方字体使用说明
  19. 03.mysql调优--索引基本实现
  20. 【Win10】电脑麦克风录音:设备调测

热门文章

  1. C语言bool类型定义
  2. java正则包含特殊字符_java – 捕获由特殊字符嵌套/包含的正则表达式组
  3. 史上最全的Web安全相关网址汇总【转帖】
  4. 动态代理的原理及其应用
  5. JS中将中文数字转化为阿拉伯数字
  6. 项目二 任务七 管理rpm软件包与压缩包
  7. 看了下大厂程序员的工资表,我酸了.....
  8. LVGL-gui_user.h
  9. android 远距离识别,远距离 人脸识别!
  10. 高德地图在H5页面中的使用(VUE)