Skip to content

bug: @Prop accessor (getter/setter) not working for attributes without type any #6309

Open
@janerikmai

Description

@janerikmai

Prerequisites

Stencil Version

4.35.1

Current Behavior

When using accessors for a @Prop() decorated property in a Stencil component, the setter is not properly invoked after hydration (attribute -> property) if the getter uses a specific return type that differs from the setter helper property. This results in the internal state never updating with the hydrated or passed-in attribute value.

So it fails when getter and helper type are equal, without any or piped any.

Demo attached

Expected Behavior

Setter is called after hydration when reading @Prop attribute without the need of any any type or additional any piping (like Test | any)

System Info

System: node 20.17.0
    Platform: darwin (24.5.0)
   CPU Model: Apple M2 Pro (12 cpus)
    Compiler: /stenciljs-bug-accessor-attribute/bug-accessor-attribute/node_modules/@stencil/core/compiler/stencil.js
       Build: 1750123236
     Stencil: 4.35.1 🦄
  TypeScript: 5.5.4
      Rollup: 4.34.9
      Parse5: 7.2.1
      jQuery: 4.0.0-pre
      Terser: 5.37.0

Steps to Reproduce

👇

Code Reproduction URL

https://codesandbox.io/p/devbox/stencil-web-component-forked-hwhtlg?file=%2Fsrc%2Fcomponents%2Fmy-component%2Fmy-component.tsx%3A16%2C1-17%2C1&workspaceId=ws_6vP1zoUcWeVzH1BNvgtUpx

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug: ValidatedThis PR or Issue is verified to be a bug within StencilHelp Wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions