glutinum-org / cli

https://glutinum.net/
59 stars 6 forks source link

order of deprecation attribute and doc comments causes warning #102

Closed joprice closed 4 months ago

joprice commented 4 months ago

When an interface member has a deprecated annotation, the following warning is shown:

info FSHARP: XML comment is not placed on a valid language element. (code 3520)

Reversing the order of the Obsolete attribute and the doc comment in the output code fixes the warning.

interface Cookie {
   /**
           * Specifies the `Date` object to be the value for the `Expires Set-Cookie` attribute.
           * By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and will delete it on a condition like exiting a web browser application.
           *
           * If both `expires` and `maxAge` are set in the options, then the last one defined in the object is what is used.
           *
           * @deprecated The `expires` option should not be set directly; instead only use the `maxAge` option
           * @see maxAge
           */
          expires?: Date | null | undefined;
}

translates into

module rec Glutinum

open Fable.Core
open Fable.Core.JsInterop
open System

[<AllowNullLiteral>]
[<Interface>]
type Cookie =
    [<Obsolete("The `expires` option should not be set directly; instead only use the `maxAge` option")>]
    /// <summary>
    /// Specifies the <c>Date</c> object to be the value for the <c>Expires Set-Cookie</c> attribute.
    /// By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and will delete it on a condition like exiting a web browser application.
    /// 
    /// If both <c>expires</c> and <c>maxAge</c> are set in the options, then the last one defined in the object is what is used.
    /// </summary>
    abstract member expires: JS.Date option option with get, set

Example of npm package using this features:

https://www.npmjs.com/package/express-session

MangelMaxime commented 4 months ago

It seems like I fixed this bug while working on another TSDoc feature, it will be included in the next release