Typescript 3.7.3
Typescript definitions for import {styled} from "linaria/react" are no longer working. The definitions are in the lib, but there are no longer definitions in the root folder, so TS doesn't know where to find them.
Try importing styled from linaria/react in any typescript project and it will fail.
Unfortunately, if I properly understood, it鈥檚 impossible to fix that issue without splitting Linaria to different npm-packages. So, it鈥檚 kind of a duplicate of https://github.com/callstack/linaria/issues/413
I'm not sure why it would be any different than the current live version in the meantime, if you could possibly keep the definitions in the root until you split it, that would allow it to keep working normally in typescript.
As a workaround in the meantime, you can change
import { styled } from 'linaria/react'; to
import { styled } from 'linaria/lib/react';
to load the typings.
@mattoni yep, you are right. Looks like we lost a couple of d.ts files. Thank you!
It was fixed in one of the latest betas.
Most helpful comment
As a workaround in the meantime, you can change
import { styled } from 'linaria/react';toimport { styled } from 'linaria/lib/react';to load the typings.