报错如下:
Type ‘string | null’ is not assignable to type ‘string’.
Type ‘null’ is not assignable to type ‘string’.ts(2322)
解决办法:
token: localStorage.getItem("token") || ''
如果觉得《Type ‘string | null‘ is not assignable to type ‘string‘. Type ‘null‘ is not assignable to type ‘》对你有帮助,请点赞、收藏,并留下你的观点哦!