Skip to content

TypeScript errors on import #394

Open
@joshkel

Description

Runtime

Node.js

Runtime version

18.20.2

Module version

11.0.2

Last module version without issue

No response

Used with

Hapi

Any other relevant information

No response

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

I'm authoring a Hapi plugin and trying to import from the Hoek project:

import * as Hoek from '@hapi/hoek';

My tsconfig.json is configured for "moduleResolution": "node16", "module": "node16".

What was the result you got?

error TS7016: Could not find a declaration file for module '@hapi/hoek'. 'node_modules/@hapi/hoek/lib/index.mjs' implicitly has an 'any' type.
  There are types at 'node_modules/@hapi/hoek/lib/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@hapi/hoek' library may need to update its package.json or typings.

11 import * as Hoek from '@hapi/hoek';
                         ~~~~~~~~~~~~

What result did you expect?

Successful compilation.

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