styled jsx for Inferno in typescript

1.5k Views Asked by At

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>'.

1

There are 1 best solutions below

0
edouardr On BEST ANSWER

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