Skip to content

Conversation

@github-actions
Copy link

This is an automatic PR generated by the CI/CD pipeline. This will be automatically fast-forward merged if successful.

@github-actions
Copy link
Author

Pipeline Attempt on 15012020916 for d818b83

https://github.com/MatrixAI/js-async-locks/actions/runs/15012020916

@aryanjassal
Copy link

The CI is failing here due to the linting failing the check here.

  public withF<T>(
    ...params: [
      ...(
        | [type?: 'read' | 'write', ctx?: Partial<ContextTimedInput>]
        | [type?: 'read' | 'write']
        | [ctx?: Partial<ContextTimedInput>]
        | []
      ),
      (lock: RWLockReader) => Promise<T>,
    ]
  ): Promise<T> {
    let type: 'read' | 'write';
    if (params.length === 2) {
      type = params.shift() as 'read' | 'write';
    } else {
      if (typeof params[0] === 'string') {
        type = params.shift() as 'read' | 'write';
      } else if (typeof params[0] == null) {  // <<< HERE!
        params.shift();
      }
    }
    type = type! ?? 'write';
    switch (type) {
      case 'read':
        return this.withReadF(...(params as any));
      case 'write':
        return this.withWriteF(...(params as any));
    }
  }

This is the error returned by the linter for this line.

  221:18  error  Unexpected constant binary expression. Compares constantly with the right-hand side of the `==`  no-constant-binary-expression
  221:38  error  Invalid typeof comparison value 

The return signature of typeof is 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function'. So, what the error is trying to say is that it is a dead branch.

Removing the typeof seems likely actually if the input type was [undefined, ...rest] but that's not an option in the types. [We should] probably just remove that whole branch.
- Brian

As we haven't worked on this codebase directly, we are unsure what the intention behind this was.

@CMCDragonkai how do you propose we fix this?

CDeltakai and others added 3 commits May 14, 2025 15:40
@github-actions
Copy link
Author

Pipeline Attempt on 15013745767 for 64ca8f4

https://github.com/MatrixAI/js-async-locks/actions/runs/15013745767

@github-actions
Copy link
Author

Pipeline Succeeded on 15013745767 for 64ca8f4

https://github.com/MatrixAI/js-async-locks/actions/runs/15013745767

@maxwell-aiden maxwell-aiden merged commit 64ca8f4 into master May 14, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants