Skip to content

[lodash] Type 'T' does not satisfy the constraint 'object'. #23375

@Ixonal

Description

@Ixonal

If you know how to fix the issue, make a pull request instead.

I just did an update of my npm packages and started getting an error in my builds:

ERROR in [at-loader] ./node_modules/@types/lodash/index.d.ts:12651:53
Type 'T' does not satisfy the constraint 'object'.

This initially confused me, as I'm not including lodash in my project. After some digging, it appears that TypeDoc recently updated their type dependencies (TypeStrong/typedoc@afd6b60#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R36). I would put in an issue there, but this seems more to be an issue specific to the types.

What it's complaining about, specifically seems to be this:

    //_.isWeakSet
    interface LoDashStatic {
        /**
         * Checks if value is classified as a WeakSet object.
         *
         * @param value The value to check.
         * @returns Returns true if value is correctly classified, else false.
         */
        isWeakSet<T>(value?: any): value is WeakSet<T>;
    }

In particular, "isWeakSet(value?: any): value is WeakSet<T>;"
If I alter T to extend object, the error goes away, but wanted to make sure that's the appropriate fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions