Skip to content

Mark `createFlash` as deprecated and improve documentation

  1. Mark createFlash as @deprecated and encourage the use of the newer, Pajama compliant, createAlert.

  2. Improve the JSDoc parameter documentation:

  • stricter type for options.type (createFlash) and options.variant (createAlert): instead of String it is now a union of constants ('success'|'warning'...)
  • add a missing parameter, options.addBodyClass, to createFlash
  • change the way to indicate optional parameters: instead of using the ?, use [...] (see JSDoc).

Improved developer experience

vscode shows that the function is deprecated (crossed) and the possible values the option type:

Screenshot_2022-04-06_at_10.07.44

In vscode, if the option "checkJs": true in jsconfig.json it will display an error for non-valid argument types:

Screenshot_2022-04-06_at_10.13.30

Edited by Eduardo Sanz García

Merge request reports

Loading