文章
24
标签
0
分类
23
首页
归档
分类
标签
关于
Decmoe47's Blog
node运行时报错TypeError Class extends value undefined is not a constructor or null(循环引用)
搜索
首页
归档
分类
标签
关于
node运行时报错TypeError Class extends value undefined is not a constructor or null(循环引用)
发表于
2025-03-16
|
更新于
2026-01-12
|
编程
nodejs
|
总字数:
17
|
阅读时长:
1分钟
|
浏览量:
解决循环引用用
madge
包
1
2
npm install madge -g
madge --circular --extensions ts ./src
文章作者:
Decmoe47
文章链接:
https://decmoe47.github.io/p/51dd8b8d/
版权声明:
本博客所有文章除特别声明外,均采用
CC BY-NC-SA 4.0
许可协议。转载请注明来源
Decmoe47's Blog
!
上一篇
Newtonsoft.Json.Linq默认不会将json值为null和undefined转换为null导致链式取值时抛异常
例如 (详细代码请查看正文) 这样的json,使用 JObject.Parse() 或者 JsonConvert.DeserializeObject() 后,直接取name的值不进行显式转换,得到的值会是 Newtonsoft.Json.JValue 的空实例,而不是null。这导致如果需要使用 ?[] 进行链式取值时(例如 (string?)json["data"]?["cards"]?[0]?["names"]?[0] 的names为null )会抛出异常,因为中间并没有显式转换过,中间值也就不是null,null 条件运算符( ?[])也就没用了。 解决办法就只能遍历值,把是null的和是undefined的删去。 (详细代码请查看正文) 参考: c# - JSON.NET serialize JObject while ignoring null properties - Stack Overflow
下一篇
prettier格式化所有文件
(详细代码请查看正文) 然后在package.json中写入: (详细代码请查看正文)
评论
最新文章
kotlin springboot的配置类报错No default constructor found——不要给bean的构造器里写默认值
2026-01-12
RestTemplate请求aws s3下载文件报错Error parsing the X-Amz-Credential parameter; the Credential is mal-formed
2026-01-06
kotlin spring项目中校验非空基本类型时@NotNull无效的问题
2025-12-21
记一次UnexpectedRollbackException解决过程
2025-12-01
记录搭建博客的过程(Hexo+Butterfly+Github Actions+Github Pages)
2025-03-17
解决Goland换主题但代码看起来五颜六色太乱的问题
2025-03-16
搜索
数据加载中