valotas / preact-context

React new Context API for preact
Other
151 stars 8 forks source link

Build Error, Node v8.0.0 or v8.11.3 #13

Closed ajmeyghani closed 6 years ago

ajmeyghani commented 6 years ago

Hi,

I'm trying to build the library(npm i && npm run build) but I'm getting the following error:

> tsc -p .

src/context.ts:27:23 - error TS7017: Element implicitly has an 'any' type because type 'string | number | object | VNode<any> | ComponentChild[]' has no index signature.

27   return (children && children[0]) || render;
                         ~~~~~~~~~~~
src/context.ts:62:32 - error TS2339: Property 'length' does not exist on type 'string | number | object | VNode<any> | ComponentChild[]'.
  Property 'length' does not exist on type 'number'.

62       if (children && children.length > 1) {
                                  ~~~~~~
src/context.ts:67:28 - error TS7017: Element implicitly has an 'any' type because type 'string | number | object | VNode<any> | ComponentChild[]' has no index signature.

67       return ((children && children[0]) || null) as JSX.Element;

I'm not that familiar with TypeScript but I would appreciate any help.

Thanks!

valotas commented 6 years ago

I will have a look at it. It has to do with the new preact.d.ts. As a workaround you can use preact v8.2 for the moment.

valotas commented 6 years ago

Latest master should be just fine now!

Happy coding