hapi icon indicating copy to clipboard operation
hapi copied to clipboard

Build issues

Open JimmyBjorklund opened this issue 2 years ago • 3 comments

Runtime

nodejs

Runtime version

v20.10.0

Module version

v20.10.0

Last module version without issue

No response

Used with

tsoa

Any other relevant information

tsc

node_modules/@hapi/hapi/lib/types/route.d.ts:2:68 - error TS2307: Cannot find module 'joi' or its corresponding type declarations.

2 import { ObjectSchema, ValidationOptions, SchemaMap, Schema } from 'joi'; ~~~~~

node_modules/@hapi/hapi/lib/types/server/server.d.ts:4:22 - error TS2307: Cannot find module 'joi' or its corresponding type declarations.

4 import { Root } from 'joi'; ~~~~~

What are you trying to achieve or the steps to reproduce?

create any packet.json and have skipLibCheck = true

What was the result you got?

node_modules/@hapi/hapi/lib/types/route.d.ts:2:68 - error TS2307: Cannot find module 'joi' or its corresponding type declarations.

2 import { ObjectSchema, ValidationOptions, SchemaMap, Schema } from 'joi'; ~~~~~

node_modules/@hapi/hapi/lib/types/server/server.d.ts:4:22 - error TS2307: Cannot find module 'joi' or its corresponding type declarations.

4 import { Root } from 'joi'; ~~~~~

What result did you expect?

No error

JimmyBjorklund avatar Mar 18 '24 16:03 JimmyBjorklund

Yeah, the hapi types require the Joi typings to compile. This is not ideal, but how it is currently. I'm sure a PR that decouples it would be very welcome.

You should be able to fix it by installing the joi module as a development dependency.

Are you sure it's not activated by skipLibCheck = false?

kanongil avatar Mar 18 '24 17:03 kanongil

If joi is required its not a dev dependency, looking in you packet.json its listed as a dev dependency. adding it to the project using npm install joi removes the error but this is a hack as i see it.

JimmyBjorklund avatar Mar 19 '24 07:03 JimmyBjorklund

Joi is only required for compiling the typescript types, so it won't be added as a normal dependency. This is similar to the typescript dev dependency.

This is indeed a hack, because there is no decent solution until someone takes the time to decouple it in the hapi typings. Again a PR would be welcome.

kanongil avatar Mar 19 '24 09:03 kanongil