Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hapi.js Version 18.x Typings

I recently upgraded my project to use the @hapi/hapi node modules vs. the old hapi module. I'm using version 18.3.1 ("@hapi/hapi": "^18.3.1").

My Typescript definitions no longer work as the Import reads: import * as Hapi from 'hapi';

When running the node process I get the module not found error. Is there a way to point the @types/hapi typings to the new @hapi/hapi module?

like image 727
Beanwah Avatar asked May 31 '19 18:05

Beanwah


1 Answers

Uninstall the @types/hapi dependency. This didn't work for me moving to 18.3.1. Instead install @types/hapi__hapi. I searched for a while and ran across that package, which seems to do the trick.

npm un @types/hapi -D
npm i @types/hapi__hapi -D

Then instead of importing from 'hapi', import from '@hapi/hapi'.

import * as Hapi from '@hapi/hapi';
like image 89
baronnoraz Avatar answered Oct 19 '22 09:10

baronnoraz