Error in typescript definitions using hapi server
See original GitHub issueError
$ 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:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Add your own typings though tsconfig, and declare the hapi module.
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.