Skip to content

[SSR v2] Restrict invalid decorator usage #4886

Open
@wjhsf

Description

@wjhsf

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions