Closed addlistener closed 1 year ago
I managed to make it work using import type from 'styled-jsx/global'
. Wouldn't it be nice that we document it?
Or could we explicitly export <reference types="styled-jsx/global" />
?
:tada: This issue has been resolved in version 5.1.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
@addlistener using Next 13.x and still facing same issue, For now created custom.d.ts
in src/
and pasted given code it works now
import 'react';
declare module 'react' {
interface StyleHTMLAttributes<T> extends React.HTMLAttributes<T> {
jsx?: boolean;
global?: boolean;
}
}
Are there any better option than that?
@adarshaacharya
Have you tried the following?
import type from 'styled-jsx/global'
<reference types="styled-jsx/global" />
We cannot do
<reference types="styled-jsx/global" />
. Andimport 'styled-jsx/global';
does not work either.I believe it's a huge pain point for people to use styled-jsx smoothly. https://github.com/vercel/styled-jsx/issues/90
We have to write a duplicated global.d.ts for the typescript code to work. Next.js do it this way. It does not make sense for people to do it every time they want to use it.