Skip to content

Deprecating Members

The @deprecated annotation marks a property, callback, or function as deprecated. Whenever the member is accessed from outside the component that declares it, the compiler emits a warning that points to the replacement. This lets a component evolve its public API while giving users a migration path instead of a hard break.

Prefix the declaration with @deprecated, followed by the message in parentheses:

in-out property <int> new-prop;
@deprecated("Please use 'new-prop' instead") in-out property <int> old-prop <=> new-prop;
slint

Accessing old-prop then warns with The property 'old-prop' has been deprecated: Please use 'new-prop' instead.

Write the message you want the user to read. There is no inference from the declaration, so say what replaces the member, even when it aliases its replacement with <=>.

When nothing replaces the member, leave the message empty:

@deprecated("") in-out property <int> going-away;
slint

The warning then just reads The property 'going-away' has been deprecated.

component Inner {
in-out property <int> new-prop;
@deprecated("Please use 'new-prop' instead") in-out property <int> old-prop <=> new-prop;
// No warning: accesses within the declaring component are fine.
in-out property <int> internal: old-prop;
}
export component Example {
inner := Inner {
new-prop: 42;
}
// Warning: The property 'old-prop' has been deprecated: Please use 'new-prop' instead
property <int> value: inner.old-prop;
}
slint
  • The message is mandatory. Write @deprecated("") to deprecate without advising on a replacement.
  • The message must be a plain string literal, without any \{} expressions.
  • Accessing a deprecated member is only a warning, never an error, so existing code keeps compiling.
  • Accesses from within the declaring component don’t warn, since that component still needs to implement the member.

For the normative rules, see Deprecation in the language specification.


© 2026 SixtyFPS GmbH