Definitelytyped: @types/hapi Update to 17.0

Created on 18 Oct 2017  路  18Comments  路  Source: DefinitelyTyped/DefinitelyTyped

  • [ ] I tried using the @types/xxxx package and had problems.
  • [ ] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [x] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [x] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @AJamesPhillips @jasonswearingen @mmc41

I was wondering if you guys are thinking of supporting the upcoming hapi v17 release with TS? Do you guys think it makes sense to already start working on the DefinitelyTyped of v17 while it is in RC mode? Or do you think there will be too much API changes until the official release on November 1st?

Most helpful comment

@lenovouser -> here the PR :)

All 18 comments

While I am interested in hapi v17 support I am actually more interested in getting existing and future hapi types to compile with typescript 2.6 which is arriving soon (an RC is available). Typescript 2.6 has strict function typing which is known to break current version of hapi types. Hapi v17 support comes after typescript 2.6 support for me. Unfortunately, I also don't have much time at the moment so I can't drive the effort although I can properly help a bit.

@BorntraegerMarc thank you very much for raising the issue. Looks like v17 release notes aren't quite ready yet but hopefully they'll be along soon.

It is limiting (but also understandable) that the type versions of packages (i.e. @types/hapi) on DefinitelyTyped are locked to the package (i.e. hapi) major version. So I also agree with @mmc41 that we should consider using "the opportunity" of a major version number bump for hapi to update the typings for the latest version of typescript. Particularly if it's going to be a major change and might involve some backwards incompatibility.

Thanks for the input. Although I don't fully understand why you want to upgrade to typescript 2.6 already now, I respect your decision. I have a feeling that the typescript changes will maybe be problematic for apps using @types/hapi -> Will they be forces to upgrade their own code & libs to typescript 2.6?

So if I understand the plan correctly it would go something like this:

  1. In the source we will add a new v17 folder
  2. Upgrade the index.d.ts to use typescript version 2.6 RC
  3. Adapt typescript code to point to latest RC of hapi
  4. Do adaption of typescript interface for hapi & use newest features of typescript 2.6 simultaneously

Did I get the plan right? If yes -> Could ether you @AJamesPhillips or @mmc41 provide an initial PR to kick of the process with the first 3 steps? After that I can help a lot with the code adaption but I'm no typescript expert. So a little help in the beginning is very appreciated 馃槃

Hey @BorntraegerMarc really happy you're interested in helping out.

Will they be forces to upgrade their own code & libs to typescript 2.6

I'm not certain but if I correctly understand what mmc41 is saying it sounds like some typescript features are incompatible with our current typings... why this would not trigger the typescript team to issue a major version update for typescript to 3.x I'm not sure. Presumably there might be a compile option to disable strict function typing @mmc41 if this would otherwise be a backwards incompatible change?

why you want to upgrade to typescript 2.6 already now

Hapi v18 might never materialise (and it would be completely unreasonable for us to expect anything of this nature just so we can publish a typescript type definition) so it's good to make the most of this opportunity presented by v17 to update and future proof the types from potential backwards incompatibility typescript 2.6 version.

Did I get the plan right?

Almost, we'd make a v16 folder first and copy the current index.d.ts and tests to that, then update the root level index.d.ts, tests and tsconfig to work with typescript 2.6 and hapi v17.

provide an initial PR

I'm happy if someone else wants to get going but personally I am going to wait until Typescript 2.6 is published in its entirety and not work on the RC, and likewise for hapi v17 (not the RC). RCs can change, types are hard enough to get right so it's best to wait for everything to settle down first.

For now I'd recommend you use hapi v16 and @types/hapi v16 unless there's a particular feature of hapi v17 that you require (?).

The issue about TS 2.6 is that strict function typing find more errors than previous versions of typescript (which is wonderful - the idea of TS is to find most errors at compile time). Done right, I expect the changes we make to types/hapi should be backward compatible so it won't force anyone to use the newest version. From what I have heard the specific incompatible typescript 2.6 things for hapi are the tests, but I haven't verified myself. See this discussion for details.

Do note that I rarely work with RC's, so I plan to wait until proper releases

Right got it. Thanks for explaining 馃憤

OK, so let's wait for the final versions to be released :) thanks for your input!
gonna leave this issue open until then...

v17.0.0 got released a few hours ago

@rafaelsouzaf what happened to your WIP types? 馃槥

@lenovouser I made some mistakes in the repository (revert/rebase/revert/reset and the chaos!) Sorry :-/ But I am going to push again today and I will keep making definitions today and the next days 馃憤

@lenovouser -> here the PR :)

@rafaelsouzaf Are you going to open a PR in this repository? It would be great to see Hapi 17 type definitions get released on NPM :)

@kijn #22462

@lenovouser Just found it, thanks.

@kjin no problem 馃憤馃徎

I think this can be closed in favor of https://github.com/DefinitelyTyped/DefinitelyTyped/pull/23497, which is the active PR for Hapi 17.

This issue can be closed, right?

Was this page helpful?
0 / 5 - 0 ratings