Repository navigation
fix(markdown-template): keep parent scope in enum optional blocks - #684
Merged
Merged
Conversation
This was referenced Oct 11, 2026
property.isPrimitive() is false for enum fields, so {{#optional billingFrequency}}
on an enum property still scoped its body to the enum declaration and
rejected {{billingFrequency}}, {{this}} and sibling variables. Treat enum optionals
as scalars, like primitives.
Follow-up to #683, raised in review of #647.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Matt Roberts <code@rbrts.uk>
mttrbrts
force-pushed
the
claude/fix-enum-optional-scope
branch
from
October 11, 2026 10:56
1d3c373 to
990ee2f
Compare
mttrbrts
enabled auto-merge (squash)
October 11, 2026 10:57
Coverage Report for CI Build 38133762789Coverage increased (+0.4%) to 83.247%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow-up to #683. @Shubh-Raj raised this case in their review of #647.
#683keeps the parent scope only when the optional property is primitive.property.isPrimitive()is false for enum fields, so an enum optional still scoped its body to the enum declaration. Onmaintoday, all of these fail withUnknown property:Change
OptionalDefinitionnow treats enum properties as scalars, like primitives:{{this}}resolves to the enum field, as anEnumVariableDefinitionwith itsenumValues.Tests
The new tests cover:
#optionalblock;{{this}}used together with named variables in the same block, for enum and primitive optionals. @Shubh-Raj also suggested this case.Results:
markdown-templatepasses (28 tests) andmarkdown-transformpasses (31).tsc --noEmitis clean, and ESLint reports no errors.🤖 Generated with Claude Code