Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SSR v2] Restrict invalid decorator usage #4886

Open
wjhsf opened this issue Nov 18, 2024 · 1 comment
Open

[SSR v2] Restrict invalid decorator usage #4886

wjhsf opened this issue Nov 18, 2024 · 1 comment

Comments

@wjhsf
Copy link
Contributor

wjhsf commented Nov 18, 2024

In the regular compiler, we disallow various forms of invalid decorator usage. The following validation should be added to the SSR compiler:

  1. Only api, track, and wire can be used as decorators.
    • @foo prop is invalid.
  2. The decorators cannot be imported and renamed.
    • import { api as API } from "lwc" is invalid.
  3. Other functions called api, wire, or track cannot be used as decorators.
    • const api = () => {}; ... @api prop is invalid.
  4. The decorators cannot be called as regular functions.
    • import { api } from "lwc"; ... api() is invalid.
  5. Other functions called api, wire, or track can be used as regular functions.
    • const api = () => {}; api(); is valid.
Copy link

git2gus bot commented Nov 18, 2024

This issue has been linked to a new work item: W-17264833

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

No branches or pull requests

1 participant