【问题标题】:styled jsx for Inferno in typescript打字稿中 Inferno 的样式化 jsx
【发布时间】:2018-07-17 09:25:35
【问题描述】:

如何为 Inferno.js 编写定义

import 'react';

declare module 'react' {
  interface StyleHTMLAttributes<T> extends React.HTMLAttributes<T> {
    jsx?: boolean;
    global?: boolean;
  }
}

因为

export const Footer = props =>
  <footer>
    <style jsx>{`{
      color: green;
    }`}</style>

  </footer>

导致错误。

[ts] 类型“DetailedHTMLProps, HTMLStyleElement>”上不存在属性“jsx”。

【问题讨论】:

    标签: typescript typescript-typings next.js infernojs


    【解决方案1】:

    你可以通过安装来解决这个问题

    npm i --save-dev @types/styled-jsx

    在这个issue下追踪到:https://github.com/zeit/styled-jsx/issues/90

    【讨论】:

      猜你喜欢
      • 2021-06-07
      • 2018-03-16
      • 2020-08-02
      • 2018-10-16
      • 2020-06-27
      • 2021-12-18
      • 1970-01-01
      • 1970-01-01
      • 2019-06-19
      相关资源
      最近更新 更多