Skip to content

Redundant condition in version check logic #671

Closed
@nishan-singh

Description

@nishan-singh

Hi,

I was reading the source code of preact signals (https://github.com/preactjs/signals/blob/main/packages/core/src/index.ts) and I noticed a small redundancy in the code.

Image

The condition node._source._version !== node._version appears twice in the if statement. I am not an expert, but I think, the second condition could be removed.

One more thing:

Typescript complains that head is of type undefined at line 498 (cleanUpSources func). I will just paste the error here:

index.ts|498 col 4-8 error| Type 'Node' is not assignable to type 'undefined'.

I think, an easy fix would be to make head have Node | undefined type.

Image

I would be happy to make a pull request to fix these minor issues and contribute to open source for the first time (well, not really, I tried to contribute to a project but it didn't go well lol)

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