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.2apollo-server-hapi v2.8.1NodeJS v12.7.0tsc v3.5.3Also, possibly related... when I compile typescript I get this:
> tsc
node_modules/apollo-server-hapi/dist/ApolloServer.d.ts:1:18 - error TS2307: Cannot find module 'hapi'.
1 import hapi from 'hapi';
~~~~~~
Found 1 error.
because I installed @hapi/hapi, not hapi. From the hapi npm page:

Changing to @hapi/hapi in ApolloServer.d.ts fixes the problem, but obviously that's not a robust solution.
@markgreenwood Thanks for your input. I actually missed the deprecation of the hapi package
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.
So for projects wanting to use apollo-server-hapi today, what is the recommended workaround?
Add your own typings though tsconfig, and declare the hapi module.
declare module 'hapi' {
export * from '@hapi/hapi';
}
Most helpful comment
Add your own typings though tsconfig, and declare the hapi module.