Linaria: Typescript Definitions not loading in 1.4.0-beta.0

Created on 3 Jan 2020  路  5Comments  路  Source: callstack/linaria

Environment


Typescript 3.7.3

Description

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.

Reproducible Demo

Try importing styled from linaria/react in any typescript project and it will fail.

Most helpful comment

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.

All 5 comments

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.

Was this page helpful?
0 / 5 - 0 ratings