[Maps] Restore original ts-expect-error for complex style type intersection for BlendedVectorLayer #244867
+3
−2
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.
Closes #187897
These two TypeScript errors were marked as after the upgrade, but it turns out that the file already contained a
ts-expect-errorbefore the upgrade, which makes it very likely that these issues are not caused by the TS upgrade, but come from the existing code.This is also the only case in the PR upgrading the TS where the file blended_vector_layer.ts already contained a
ts-expect-errorbefore the upgrade - see the link, which makes it very likely that the new comment about the upgrade-related error was added by mistake.I tried to fix the issue, but the type intersections here are very complex, and solving this properly would require a larger refactor. Because of that, I suggest restoring the previous TypeScript comment and removing the note about the upgrade, since the error wasn’t introduced by the new TypeScript version.
The problem concerned the type
StylePropertyOptions/DynamicStylePropertyOptions/StaticStylePropertyOptions, which are a combination of many possible shapes using a large union + intersection of types.When cloning styles (e.g., copying properties into
clusterStyleDescriptor.properties[styleName]), TypeScript reported that the created object does not satisfy all the properties required by this huge intersection, for example:fieldMetaOptionsminSizemaxSizeIn other words:
TS tried to match the object to the fully “merged” types, which in practice never exist together, because at runtime many variants are allowed, but TS treats the intersection very strictly.
Therefore, the only realistic solution was:
accept a
ts-expect-erroror
change the entire type system (which was not the goal of this PR)