Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.1 Array.isArray breaking change review #41808

Open
RyanCavanaugh opened this issue Dec 3, 2020 · 2 comments · May be fixed by #48228
Open

4.1 Array.isArray breaking change review #41808

RyanCavanaugh opened this issue Dec 3, 2020 · 2 comments · May be fixed by #48228
Assignees
Labels
Fix Available Meta-Issue Rescheduled

Comments

@RyanCavanaugh
Copy link
Member

@RyanCavanaugh RyanCavanaugh commented Dec 3, 2020

Categorizing breaks we've seen from this

#41658, #41714

type Comparable = string | undefined | Array<string>;
export function check<T extends Comparable>(a: T) {
	if (Array.isArray(a)) {
		// 4.0: m: string
		// 4.1: Error, cannot index
		const m = a[0];
	}
}

#41610

const aggregatedResults: (number[] | null | 'loading')[] = [[1, 2], null, [3, 4], 'loading', [5, 6]]
// 4.0: onlyTheArrays: number[][]
// 4:1 Error, no overload matches this
const onlyTheArrays = aggregatedResults.filter<number[]>(Array.isArray) // number[][]
@RyanCavanaugh RyanCavanaugh added the Meta-Issue label Dec 3, 2020
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.1.3 milestone Dec 3, 2020
orta added a commit to orta/TypeScript that referenced this issue Dec 7, 2020
@typescript-bot typescript-bot added the Fix Available label Dec 7, 2020
orta added a commit to orta/TypeScript that referenced this issue Dec 7, 2020
@jameswilddev
Copy link

@jameswilddev jameswilddev commented Dec 13, 2020

Hello! Can I just confirm this is fixed in 4.1.3 (released two days ago) as hinted above? I'm having difficulty upgrading from 4.1.2 to 4.1.3 as Array.isArray guard behaviour has changed and want to make sure that any changes I'm making are correct and not mitigations for a (temporary) tool bug.

@RyanCavanaugh
Copy link
Member Author

@RyanCavanaugh RyanCavanaugh commented Dec 14, 2020

Correct, 4.1.3 contains the revert

@andrewbranch andrewbranch removed this from the TypeScript 4.4.1 (RC) milestone Aug 31, 2021
@andrewbranch andrewbranch added this to the TypeScript 4.5.0 milestone Aug 31, 2021
@RyanCavanaugh RyanCavanaugh removed this from the TypeScript 4.5.0 milestone Dec 15, 2021
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.6.0 milestone Dec 15, 2021
@RyanCavanaugh RyanCavanaugh removed this from the TypeScript 4.6.0 milestone Feb 3, 2022
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.6.1 milestone Feb 3, 2022
@jablko jablko linked a pull request Mar 11, 2022 that will close this issue
@RyanCavanaugh RyanCavanaugh removed this from the TypeScript 4.6.1 milestone May 13, 2022
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.8.0 milestone May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Available Meta-Issue Rescheduled
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants