Replies: 1 comment
-
I think there is maybe some tweaking we should do to the templated types so that they all have a templatedeclarationode and this intersection is not needed. However for this specific case, I am assuming you are only looking to get template instance in that case I would use |
Beta Was this translation helpful? Give feedback.
-
We have the following code:
Inside the
if
statement,operation
gets narrowed tonever
. This happens becauseisTemplateDeclaration
is defined as:and
Operation
is defined as:and
OperationStatementNode
as:So,
Operation
always has anode
with typeTemplateDeclarationNode
making theOperation
always a template declaration. So, typescript correctly deduces thatisTemplateDeclaration(operation)
can never be false.I wonder what's up here. Is that
if
statement safe to remove or is something wrong else where?Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions