Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build issues #4491

Open
JimmyBjorklund opened this issue Mar 18, 2024 · 3 comments · May be fixed by #4497
Open

Build issues #4491

JimmyBjorklund opened this issue Mar 18, 2024 · 3 comments · May be fixed by #4497
Labels
bug Bug or defect

Comments

@JimmyBjorklund
Copy link

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 JimmyBjorklund added the bug Bug or defect label Mar 18, 2024
@kanongil
Copy link
Contributor

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?

@JimmyBjorklund
Copy link
Author

JimmyBjorklund commented Mar 19, 2024

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.

@kanongil
Copy link
Contributor

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 kanongil linked a pull request Apr 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug or defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants