hapi-swagger: TypeScript Compiler reports error in type definitions
Issue
When using the TypeScript type defintions in “index.d.ts”, the TypeScript compiler reports an error in line 3 of that file:
node_modules/hapi-swagger/index.d.ts:3:16 - error TS2665: Invalid module name in augmentation. Module '@hapi/hapi' resolves to an untyped module at 'somepath/node_modules/@hapi/hapi/lib/index.js', which cannot be augmented.
Environment
Using hapi-swagger 10.1.1 and TypeScript 3.6.3
Steps to Reproduce
Use the TypeScript type definitions somewhere.
Expected Behavior
The TypeScript Compiler should not report an error.
Actual Behavior
The following error is reported by the TypeScript Compiler
node_modules/hapi-swagger/index.d.ts:3:16 - error TS2665: Invalid module name in augmentation. Module '@hapi/hapi' resolves to an untyped module at 'somepath/node_modules/@hapi/hapi/lib/index.js', which cannot be augmented.
Reproducible Demo
None
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 19
@robmcguinness Thanks for your answer. I have to admit that even though I use Typescript heavily, I never wrote type definitions myself. Therefore I am not sure what exactly the problem is.
However if I change line 3 from
declare module '@hapi/hapi'to
declare module 'hapi/hapi'(i.e. I just removed the ‘@’) the compiler stops complaining. But I have no idea, if this is the right solution here or whether this has some side-effects.
Maybe we could keep this issue open, so that we can see, if others have the same problem as well.
@overra if you haven’t already can you try
npm i @types/hapi__hapiand see if problem goes away?