What is this syntax in the tutorial? #1673
-
In this tutorial: https://remix.run/docs/en/v1/tutorials/blog function isValidPostAttributes(
attributes: any
): attributes is PostMarkdownAttributes {
return attributes?.title;
} What is the |
Beta Was this translation helpful? Give feedback.
Answered by
AlexandrLi
Jan 27, 2022
Replies: 1 comment 1 reply
-
This is a user-defined type guard. You can read more about it in docs https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
fnick851
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a user-defined type guard. You can read more about it in docs https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates