Skip to content

Conversation

@olapawlus
Copy link
Member

@olapawlus olapawlus commented Dec 2, 2025

Closes #187897

These two TypeScript errors were marked as after the upgrade, but it turns out that the file already contained a ts-expect-error before 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-error before the upgrade - see the link, which makes it very likely that the new comment about the upgrade-related error was added by mistake.

Screenshot 2025-12-02 at 10 59 30

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:

  • missing fieldMetaOptions
  • missing minSize
  • missing maxSize
  • missing several fields depending on the specific style variant

In 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-error

    or

  • change the entire type system (which was not the goal of this PR)

@olapawlus olapawlus self-assigned this Dec 2, 2025
@olapawlus olapawlus added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// technical debt Improvement of the software architecture and operational architecture release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting v9.3.0 labels Dec 2, 2025
@olapawlus olapawlus marked this pull request as ready for review December 2, 2025 10:00
@olapawlus olapawlus requested a review from a team as a code owner December 2, 2025 10:00
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

clusterStyleDescriptor.properties[styleName] = {
type: STYLE_TYPE.DYNAMIC,
// @ts-expect-error upgrade typescript v5.1.6
// @ts-expect-error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough analysis. Do you mind adding a summarized reason to both @ts-expect-error?

Suggested change
// @ts-expect-error
// @ts-expect-error <description why we ignore type error>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// technical debt Improvement of the software architecture and operational architecture v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix "@ts-expect-error upgrade typescript v5.1.6" in presentation code

3 participants