月白色的大狒

关注

ts 类型“”string|null“”的参数不能赋给类型 string 的参数

月白色的大狒

关注

阅读 83

2023-04-03


 const
   
  strorageSelectedFilter
   
  =
   
  localStorage
  .
  getItem
  (
  selectedFilter
  );
 

 

   
  if
   (
  strorageSelectedFilter
  ){
 

 

   
  const
   
  strorageFilter
   
  =
   (
  _
  .
  values
  (JSON.
  parse
  (
  strorageSelectedFilter
  )));
 



localStorage是string| null。 

JSON.parse需要的事string类型

只要判断一下不为null。再操作

相关推荐

少_游

TS 类型“(data: string) => void”的参数不能赋给类型“unknown[]”的参数

少_游 29 0 0

大师的学徒

给content字段赋值的时候,报:类型“string | undefined”的参数不能赋给类型“SetStateAction<string>”的

大师的学徒 47 0 0

像小强一样活着

response.setContentType()的String参数及对应类型

像小强一样活着 146 0 0

静悠

mybatis中传入ids String类型参数异常

静悠 69 0 0

kiliwalk

ts 参数默认类型设置

kiliwalk 187 0 0

码农K

String类型

码农K 197 0 0

zhyuzh3d

CharSequence类型与String类型的区别

zhyuzh3d 194 0 0

读思意行

Long类型转为String类型

读思意行 81 0 0

花海书香

redis的string类型用法

花海书香 54 0 0

楠蛮鬼影

js String类型

楠蛮鬼影 13 0 0

精彩评论(0)

0 0 举报