streamich / libreact

Collection of useful React components
The Unlicense
2.63k stars 81 forks source link

I'm getting a compile error using WindowWidthSensor #17

Closed zeromancer closed 6 years ago

zeromancer commented 6 years ago

Error Message:

Failed to compile.
lib/WindowWidthSensor/index.d.ts
(2,42): Cannot find module '../typing'.

Example code:

import * as React from "react"
import { WindowWidthQuery } from "libreact/lib/WindowWidthQuery"
import { View } from "libreact/lib/View"

export function WindowWidthExample(): JSX.Element {
  return (
    <div>
      <WindowWidthQuery>
        <View maxWidth={300}>This will not render.</View>
        <View>This will render!</View>
      </WindowWidthQuery>
    </div>
  )
}

Using:

 "libreact": "^2.2.0",
streamich commented 6 years ago

Using JS this seems to work: https://codesandbox.io/s/3vzp2y8ry5

I guess, the typings.d.ts file is missing on NPM.

zeromancer commented 6 years ago

Yes, im using a Typescript The problem occurs the moment I import WindowWidthSensor and wount compile, even if not used in the source code itself.

Could you upload the typings to npm ? Because it does not seem like I can do something to fix the problem on my side....

streamich commented 6 years ago

Try the latest version.