sveltejs / language-tools

The Svelte Language Server, and official extensions which use it
MIT License
1.26k stars 200 forks source link

`@deprecated` JSDoc isn't respected for component props #2491

Open theetrain opened 2 months ago

theetrain commented 2 months ago

Description

Deprecating component props do not yield any apparent warnings in Svelte 4 and Svelte 5.

Example Svelte 4 code:

<script>
  /**
   * @type { boolean }
   * @deprecated Will be removed in next major.
   */
  export let test = false
</script>

Example Svelte 5 code:

<script>
  /**
   * @typedef {boolean} Test
   * @deprecated Will be removed in next major.
   */

  /** @type {{ test: Test }} */
  let { test } = $props()
</script>

Proposed solution

When deprecating a component prop:

Alternatives

No response

Additional Information, eg. Screenshots

Svelte 5 example, props used internally are crossed out. In this image, burst is incorrectly crossed out.

image

No deprecation warning when consuming Svelte 5 component.

image

Svelte 4 example, internal usage is correctly deprecated.

image

Consumption is documented as deprecated without being crossed out.

image
jasonlyu123 commented 2 months ago

Probably related to https://github.com/microsoft/TypeScript/issues/45657