coveo/ui-kit

[Bug]: Type issues with pino-std-serializers

Closed this issue · 4 comments

Which product are you using?

Headless

product version

2.8.3

bug description

Getting this typecheck error while using coveo headless 2.8.3

error TS2688: Cannot find type definition file for ‘pino-std-serializers’.
The file is in the program because:
Entry point for implicit type library ‘pino-std-serializers’
Found 1 error.

Steps to reproduce

Added coveo headless 2.8.3 to the repo

used coveo headless to generate engine config and search box controllers

running typecheck gives the above error

manually adding pino-std-serializers solves the issue but we do not want to add something we do not use as dev dependency

Relevant log output

error TS2688: Cannot find type definition file for ‘pino-std-serializers’.
  The file is in the program because:
    Entry point for implicit type library ‘pino-std-serializers’
Found 1 error.

Hi @vikrant-harness,

Are you using yarn in your project? I was able to reproduce the issue with the latest version of Headless when using yarn instead of npm.

When running yarn install, the index.d.ts is missing from the pino-std-serializers package. I am still investigating the root cause, but based on the error message you provided, I see several alternatives to avoid the issue:

  1. Extend the typeRoots property by adding the path of pino-std-serializers definition file.
// tsconfig.json
...
"typeRoots": ["./node_modules/@types", "./node_modules/@types/pino-std-serializers/node_modules"],
...
  1. Manually installing the type definition
yarn add @types/pino-std-serializers -D
  1. Update to the latest version of Yarn (Yarn Berry) as it provides improved type-checking features that can help resolve these type of issues.

I would recommend the third option to avoid adding "patch solutions". I will check if I can get more info on the root cause

Hi @y-lakhdar , The first solution worked for us and as for the second and third are currently not an option for us , Can we find the root cause of the issue as ideally we should not be adding this as well .

Hi @vikrant-harness ,
I have addressed the issue by bumping pino's version.
Fixed in 2.16.1

Let me know if you still experience the issue