1. 错误代码

参考:https://www.mmbyte.com/article/92849.html

1 state.localuserInfo = JSON.parse(localStorage.getItem('userInfo'))  //Argument of type 'string | null' is not assignable to parameter of type 'string'. Type 'null' is not assignable to type 'string'

'string | 类型的参数 null' 不能分配给“字符串”类型的参数。类型 'null' 不能分配给类型 'string'

修复

1 state.localuserInfo = JSON.parse(localStorage.getItem('userInfo') || '')

2.错误提示

参考https://blog.csdn.net/weixin_39651562/article/details/112597090

import Cookies from 'js-cookie'  //Could not find a declaration file for module 'js-cookie'."/Users/fanshun/Desktop/project/vue3/vue3_elementp lus /node_modules/js-cookie/ index. js'implicitly has an "any' type.Try npm i --save-dev @types/js-cookie* if it exists or add a new declaration (.d. ts) filecontaining * declare module 'js-cookie'; Vetur(7016)

有的npm包使用原生js没问题,换ts后某些包会报“Could not find a declaration file for module”的错误。

有以下两种方式解决

1、下载 @type/报错包(部分包开发者可能没有上传自己的.d.ts代码到npm分支,这时会报错说找不到这个包,别急看下一步)

2、最直接简单有效的解决方法:项目根目录下shims-vue.d.ts文件

1 declare module '*.vue' {
2 import type { DefineComponent } from 'vue'
3 const component: DefineComponent<{}, {}, any>
4 export default component
5 }
6
7 declare module 'js-cookie' //加上这一句

ts中报错信息收集的更多相关文章

  1. Python报错信息收集(1)

    UnboundLocalError: local variable 'count' referenced before assignment 局部变量错误:赋值之前引用的本地变量'count' ,un ...

  2. ThinkPHP5.0中报错could not find driver的解决方式

    这个报错是我的tp5项目转移到另外的服务器中发生的错误, 其中报错信息中还包含这pdo等字眼 解决方法:在php.ini中开启php_pdp_mysql.dll

  3. 报错信息ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by............)

    报错信息ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by............) L ...

  4. 【前端】诸葛io收集前端js报错信息

    转载请注明出处:http://www.cnblogs.com/shamoyuu/p/zhuge_error.html 一.什么是诸葛io 诸葛io就是通过分析用户的操作事件对用户数据,行为路径等进行分 ...

  5. python写一个信息收集四大件的脚本

    0x0前言: 带来一首小歌: 之前看了小迪老师讲的课,仔细做了些笔记 然后打算将其写成一个脚本. 0x01准备: requests模块 socket模块 optparser模块 time模块 0x02 ...

  6. Kali Linux信息收集工具

    http://www.freebuf.com/column/150118.html 可能大部分渗透测试者都想成为网络空间的007,而我个人的目标却是成为Q先生! 看过007系列电影的朋友,应该都还记得 ...

  7. Exp6 信息收集与漏洞扫描

    一.实践过程 1.信息收集 1.1 通过DNS和IP查询目标网站的信息 (1)whois命令用来进行域名注册信息查询,可查询到3R注册信息,包括注册人的姓名.组织和城市等信息. whois baidu ...

  8. Oracle 统计信息收集

    官网网址参考: https://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_stats.htm#CIHBIEII https://docs.ora ...

  9. VM装mac10.9教程+报错信息解决办法

    VM装mac10.9教程+报错信息解决办法 教程1: 教你在Vmware 10下安装苹果Mac10.9系统 地址:http://tieba.baidu.com/p/2847457021 教程2: VM ...

  10. 20155229《网络对抗技术》Exp6:信息收集与漏洞扫描

    实验内容 (1)各种搜索技巧的应用 (2)DNS IP注册信息的查询 (3)基本的扫描技术:主机发现.端口扫描.OS及服务版本探测.具体服务的查点 (4)漏洞扫描:会扫,会看报告,会查漏洞说明,会修补 ...

随机推荐

  1. PriorityQueue&&Function overload

    用 STL 里面堆算法实现的与真正的STL里面的 priority_queue用法相似的priority_queue    #include <iostream>    #include ...

  2. 【JIRA】jira issue reindex

    参考文档: https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Scriptrunner-Listener-Reindex ...

  3. PYQT搭建相关记录

    class Demo(QWidget): def __init__(self): super(Demo, self).__init__() # 设置标题 icon 尺寸 self.setWindowT ...

  4. PointGNN未修改之前的结果 ---行人,骑行者

    dl 18 23

  5. windows tips

    u启动经典dos工具实现硬盘分区教程 https://jingyan.baidu.com/article/a3f121e4dbe55afc9052bbfe.html?st=2&net_type ...

  6. nvm的下载安装

    nvm下载地址:https://github.com/coreybutler/nvm-windows/releases 下载包,双击安装,选取路径, 注意:如果按默认的,安装在c盘的话,那之后的切换版 ...

  7. nvm use时报错 exit status 1:一堆乱码,exit status 5

    如图,nvm list 的时候,在只有一个node版本的时候,也没有指向,表示未启用到这个版本 当使用nvm use 12.13.1的时候,报错 原因是我在之前多次安装node,出错了就删除包,再次安 ...

  8. 自动化兼容性测试工具——WeTest

    这个作业属于哪个课程 2021春软件工程实践|W班(福州大学) 这个作业要求在哪里 软件工程实践总结&个人技术博客 这个作业的目标 分享自动化兼容性测试工具的使用 其他参考文献 ... 目录 ...

  9. Markdown操作方法

    Markdown学习 标题 三级标题 四级标题 字体 原本 hello,world! 斜体 hello,world! 加粗 hello,world! 斜体加粗 hello,world! 删除 hell ...

  10. CSS clip-path 属性

    属性定义及使用说明 clip-path 属性使用裁剪方式创建元素的可显示区域.区域内的部分显示,区域外的隐藏.可以指定一些特定形状. 注意: clip-path 属性将替换已弃用的 clip 属性. ...