Skip to content

Conversation

JounQin
Copy link
Member

@JounQin JounQin commented Oct 20, 2025

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and discussions and couldn’t find anything or linked relevant results below
  • I made sure the docs are up to date
  • I included tests (or that’s not needed)

Description of changes

ReadonlyArray also covers Array already.

TypeScript Playground

@JounQin JounQin requested a review from wooorm October 20, 2025 14:24
@github-actions github-actions bot added the 👋 phase/new Post is being triaged automatically label Oct 20, 2025
@JounQin JounQin requested a review from Copilot October 20, 2025 14:24
@github-actions github-actions bot added 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Oct 20, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR simplifies TypeScript type definitions by removing redundant Array type annotations, since ReadonlyArray already covers Array types in TypeScript's type system.

  • Removed duplicate Array<Props | TestFunction | string> from the Test typedef
  • Removed redundant Array<string> overload from the type annotation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@wooorm
Copy link
Member

wooorm commented Oct 22, 2025

Hmm, it makes some sense. Verified with:

const a: Array<number> = [1]

function x(y: ReadonlyArray<number>) {
  console.log(y)
}

a.push(2)

x(a)

a.push(3)

@wooorm wooorm merged commit 82b9c25 into main Oct 22, 2025
7 checks passed
@wooorm wooorm deleted the refactor/types branch October 22, 2025 10:53
@github-actions

This comment has been minimized.

@wooorm wooorm added ☂️ area/types This affects typings 💪 phase/solved Post is done labels Oct 22, 2025
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

☂️ area/types This affects typings 💪 phase/solved Post is done

Development

Successfully merging this pull request may close these issues.

4 participants