typescripttypescript-typingsnext.jsinfernojs

styled jsx for Inferno in typescript


How can I write definitions for Inferno.js

import 'react';

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

because

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

  </footer>

causes an error.

[ts] Property 'jsx' does not exist on type 'DetailedHTMLProps, HTMLStyleElement>'.


Solution

  • You can fix this by installing

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

    It was tracked under this issue: https://github.com/zeit/styled-jsx/issues/90