【问题标题】:Type '{ dateStyle: string; }' has no properties in common with type 'DateTimeFormatOptions'.ts(2559)输入'{日期样式:字符串; }' 与类型 'DateTimeFormatOptions'.ts(2559) 没有共同的属性
【发布时间】:2021-01-14 02:24:55
【问题描述】:

“打字稿”:“^4.0.3”

如何解决我在以下代码中收到的上述打字稿错误?:

组件/OrderListItem.tsx

const newedate = (_date) => {
  const options = {dateStyle: 'medium'}; //{ weekday: 'long', hour: 'numeric'};
  const dateT = new Intl.DateTimeFormat('en-UK', options).format(_date);
  return dateT;
}

我的部分回购在这里:https://github.com/TheoMer/next_apollo

【问题讨论】:

    标签: reactjs typescript


    【解决方案1】:

    我向打字员发布了这个问题,结果发现这是一个错误:https://github.com/microsoft/TypeScript/issues/40806

    【讨论】:

      猜你喜欢
      • 2019-08-03
      • 2019-09-09
      • 2021-07-27
      • 1970-01-01
      • 1970-01-01
      • 2023-01-05
      • 2017-11-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多