glutinum-org / cli

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

Rework TSDoc parser to use a custom parser instead of the TypeScript provided API. #105

Open MangelMaxime opened 4 months ago

MangelMaxime commented 4 months ago

Issue created from Glutinum Tool

Glutinum version - 0.6.0

TypeScript

/**
 * @throws {@link BookNotFoundError}
 * Thrown if the ISBN number is valid, but no such book exists in the catalog.
 */
declare function fetchBookByIsbn();

FSharp

module rec Glutinum

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

[<Erase>]
type Exports =
    [<Import("fetchBookByIsbn", "REPLACE_ME_WITH_MODULE_NAME")>]
    static member fetchBookByIsbn () : unit = nativeOnly

Problem description

TypeScript provided API doesn't support all the TSDoc tags and it also reports invalid/incomplete situations.

For example, in the snippet above it is not able to return the full comment.

Creating our own parser should not be too difficult as the TSDoc format seems simple enough. Will need to have a release of my parser library to do that.