We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Type inferance
This bug occurs in version 4.5.2;
Playground link with relevant code
function tIsOfTypeP(t: T): t is P { // Logic } const array: T[] = [...]; // newArray is still of type T[] const newArray = array .filter(t => tIsOfTypeP(t));
The variable newArray is of type Array<T>.
newArray
Array<T>
The variable newArray is of type Array<P>. You know that only elements will remain of type P.
Array<P>
P
The text was updated successfully, but these errors were encountered:
Duplicate of #20218. You're not passing a type guard function to filter.
filter
Sorry, something went wrong.
Shouldn't the type of the lambda become a typeguard?
No. See #10734.
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.
No branches or pull requests
Bug Report
π Search Terms
Type inferance
π Version & Regression Information
This bug occurs in version 4.5.2;
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
The variable
newArray
is of typeArray<T>
.π Expected behavior
The variable
newArray
is of typeArray<P>
. You know that only elements will remain of typeP
.The text was updated successfully, but these errors were encountered: