question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in typescript definitions using hapi server

See original GitHub issue

Error

$ tsc -p .
node_modules/apollo-server-hapi/dist/ApolloServer.d.ts:1:8 - error TS1192: Module '"/builds/cloudnet/api/node_modules/@types/hapi/index"' has no default export.

1 import hapi from 'hapi';
         ~~~~


Found 1 error.

error Command failed with exit code 2.

Reproducible, when using import { ApolloServer } from 'apollo-server-hapi';

Used versions

  • hapi v18.1.9
  • @types/hapi v18.0.2
  • apollo-server-hapi v2.8.1
  • NodeJS v12.7.0
  • tsc v3.5.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
wadedoscommented, Feb 9, 2020

Add your own typings though tsconfig, and declare the hapi module.

declare module 'hapi' {
    export * from '@hapi/hapi';
}
2reactions
abernixcommented, Aug 27, 2019

Just as a note to those following along: A partial solution to this update started in #3089 but we reverted it in #3111. This is not just an update to a new package namespace, but also a necessity to update from Hapi 17 to Hapi 18 (AS2 currently uses Hapi 17). Another attempt in #3217 made similar updates, but the semver incompatibility of the update remains the same. 😭

See my comment in https://github.com/apollographql/apollo-server/pull/3217#issuecomment-525291573 which hopefully points toward a better future approach here, but right now we can’t land this without a major version bump. I certainly don’t feel great that this tight version pairing has been and continues to be restrictive. We’ll make this better — and we’re going to need some time to get Apollo Server 3.x out the door — but for now, this is the (not so Hapi) state of affairs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Typescript with hapi - Paul Walker
The type definitions in this post are all coming from DefinitelyTyped. Next, we have to create a tsconfig. json file with the Typescript...
Read more >
hapi-router issue with typescript - Stack Overflow
I am using hapi-router npm module. Can not use hapi-router with typescript. ... It gives me an error: "Can not use import statement...
Read more >
hapi-error - npm
Start using hapi-error in your project by running `npm i hapi-error`. There are 28 other projects in the npm registry using hapi-error.
Read more >
Chapter 1 Basics of Hapi & TypeScript - Softcover
1.3 Adding routes ... When we executed our first code Listing 1.1, we got an error {"statusCode":404, "error":"Not Found"} . As we found...
Read more >
lab v24.7.1 - hapi.dev
A TypeScript definition file is included with lab to make it easier to use inside ... --lint-errors-threshold - maximum absolute amount of linting...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found