lwc icon indicating copy to clipboard operation
lwc copied to clipboard

[SSR v2] Restrict invalid decorator usage

Open wjhsf opened this issue 1 year ago • 1 comments

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.

wjhsf avatar Nov 18 '24 20:11 wjhsf

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

git2gus[bot] avatar Nov 18 '24 20:11 git2gus[bot]