Skip to content

Build issues #4491

Open
Open

Description

@JimmyBjorklund

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

Activity

  1. kanongil commented on Mar 18, 2024

    @kanongil
    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?

  2. JimmyBjorklund commented on Mar 19, 2024

    @JimmyBjorklund
    Author

    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.

  3. kanongil commented on Mar 19, 2024

    @kanongil
    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug or defect

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions