nodejs-logging icon indicating copy to clipboard operation
nodejs-logging copied to clipboard

This package must declare `@types/long` as a dependency

Open alamothe opened this issue 4 years ago • 3 comments

This package must declare @types/long as a dependency since it's importing "long" in its typings.

Please check: https://yarnpkg.com/getting-started/migration#fix-dependencies-with-packageextensions

alamothe avatar Nov 14 '21 07:11 alamothe

hi @alamothe , can you be more specific about this dependency? I do not find the use of long type anywhere in the code.

minherz avatar Nov 14 '21 16:11 minherz

@minherz Thank you for your reply!

It exists in the build artifact under build/protos/protos.d.ts:

import * as Long from "long";
import {protobuf as $protobuf} from "google-gax";
/** Namespace google. */
export namespace google {

    /** Namespace protobuf. */
    namespace protobuf {

        /** Properties of a Duration. */
        interface IDuration {

            /** Duration seconds */
            seconds?: (number|Long|string|null);

The way I understand it is, TypeScript will complain unless @types/long is included as someone else's dependency. However, Yarn 2 is strict about this and it results in a compile-time error.

alamothe avatar Nov 14 '21 18:11 alamothe

Thank you. So, you are looking to add this type to the list of dependencies in the package.json: https://github.com/googleapis/nodejs-logging/blob/ee07a7df9bfffc549754dd1915039d846e4c042f/package.json#L47

We have the package on Yarn 2 for quite some time and this is a first time we get this request. Can you please describe the environment you are running and what error you get at compile time? We would like to reproduce the problem in order to understand why it wasn't raised before.

minherz avatar Nov 15 '21 10:11 minherz