react-hyperscript-helpers icon indicating copy to clipboard operation
react-hyperscript-helpers copied to clipboard

Invalid types for Typescript 2.0.3

Open davidpelaez opened this issue 9 years ago • 2 comments

Hi.

We are using Typescript 2.0.3 (the latest) in a project. You ship with the NPM pkg an index.d.ts which apparently doesn't work with my version. Here are some examples of the many errors (all related to a missing argument to a type with a generic):

node_modules/react-hyperscript-helpers/lib/index.d.ts(528,44): error TS2314: Generic type 'ReactElement<P>' requires 1 type argument(s).
node_modules/react-hyperscript-helpers/lib/index.d.ts(529,62): error TS2314: Generic type 'ReactElement<P>' requires 1 type argument(s).
node_modules/react-hyperscript-helpers/lib/index.d.ts(530,52): error TS2314: Generic type 'HTMLAttributes<T>' requires 1 type argument(s).
node_modules/react-hyperscript-helpers/lib/index.d.ts(530,90): error TS2314: Generic type 'ReactElement<P>' requires 1 type argument(s).
node_modules/react-hyperscript-helpers/lib/index.d.ts(531,34): error TS2314: Generic type 'HTMLAttributes<T>' requires 1 type argument(s).
node_modules/react-hyperscript-helpers/lib/index.d.ts(531,72): error TS2314: Generic type 'ReactElement<P>' requires 1 type argument(s).
node_modules/react-hyperscript-helpers/lib/index.d.ts(532,44): error TS2314: Generic type 'ReactElement<P>' requires 1 type argument(s).
node_modules/react-hyperscript-helpers/lib/index.d.ts(533,62): error TS2314: Generic type 'ReactElement<P>' requires 1 type argument(s).
node_modules/react-hyperscript-helpers/lib/index.d.ts(534,52): error TS2314: Generic type 'HTMLAttributes<T>' requires 1 type argument(s).

I think the correct approach would be to remove the types from the default NPM pkg, release them under @types/ so that custom declarations can be included or if someone uses and older version or newer of the types they can handle a out of the situation and include the applicable typings.

I have been unable to find a way to not read the included declaration so my project simply breaks because I cannot edit a node_modules file to fix the types.

I opened a related question in StackOverflow and I'm simply stuck and I think I'll have to vendor the code manually and avoid NPM. :(

I'm not entirely convinced about the correct way to treat this, any help is appreciated and if applicable maybe this should impact the next release?

Thanks!

davidpelaez avatar Oct 21 '16 16:10 davidpelaez

Here's the link to the SO question if it's any use http://stackoverflow.com/questions/40181022/in-typescript-how-to-ignore-npm-packages-built-in-declaration-file

davidpelaez avatar Oct 21 '16 16:10 davidpelaez

What changes to to the types did you make to get your project to compile correctly?

nspaeth avatar Jun 03 '17 23:06 nspaeth