即使代码已修复,打字稿也会出现错误

问题描述

我有一个错字并要求green[4500](而不是green[500])(实际上)不存在(在Material UI中,但这并不重要)。

所以我遇到了打字错误,因为Property '4500' does not exist on type ...无论green的类型如何。是。

然后我将其修复并保存,但仍然出现错误。即使错误具有固定代码,但错误仍然存​​在。

Property '4500' does not exist on type '{ 50: "#e8f5e9"; 100: "#c8e6c9"; 200: "#a5d6a7"; 300: "#81c784"; 400: "#66bb6a"; 500: "#4caf50"; 600: "#43a047"; 700: "#388e3c"; 800: "#2e7d32"; 900: "#1b5e20"; A100: "#b9f6ca"; A200: "#69f0ae"; A400: "#00e676"; A700: "#00c853"; }'. Did you mean '400'?  TS2551

     6 | 
     7 | const StartButton = styled(Button)({
  >  8 |   background: green[500],|                     ^
     9 |   color: 'white'
    10 | })
    11 | const StopButton = styled(Button)({

重新启动服务器即可修复它,这并不奇怪。我正在使用WebStorm并从运行菜单(而不是直接从终端)运行服务器(如果有任何区别)。

为什么打字稿落后?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)