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

Array.prototype.filter( Boolean ) has incorrect return type #1576

Closed
kkmuffme opened this issue Jun 18, 2023 · 1 comment
Closed

Array.prototype.filter( Boolean ) has incorrect return type #1576

kkmuffme opened this issue Jun 18, 2023 · 1 comment

Comments

@kkmuffme
Copy link

https://www.typescriptlang.org/play?#code/FAMwrgdgxgLglgewgAhAhAKZBnApjeCAc2wC5kAlXKBAJwBMAebGWuYgGh1faIB8IYADZCAfMgCU5Fm2IBtALrAA3sACQtfGFoo5OfIRIA6eggC2AQ3YBGLngK9sJ81YgAmOwcfPL7AMyeDsROpr4QACyBhiEu7ACsUd6hrgBsicE+rgDs6cbJ7AAcuTFhAJzFmTYADMgKRiBwQjC4tFgAQuhCuBYoEgDcwAC+wEA

function foo( settings: Record<string, string|null> ): string[]
{
	return [ settings.domain1, settings.domain2, settings.domain3, settings.domain4, settings.domain5, settings.domain6, settings.domain7, settings.domain8, settings.domain9, settings.domain10 ].filter( Boolean );
}

.filter( Boolean ) will remove all falsy elements from the array.

@orta
Copy link
Contributor

orta commented Jun 18, 2023

You're looking for microsoft/TypeScript#16655

@jakebailey jakebailey closed this as not planned Won't fix, can't repro, duplicate, stale Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants