Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript parsing issue with @ symbol in docstring #147

Open
johncsnyder opened this issue Jun 29, 2021 · 0 comments
Open

Typescript parsing issue with @ symbol in docstring #147

johncsnyder opened this issue Jun 29, 2021 · 0 comments

Comments

@johncsnyder
Copy link

With this example.d.ts:

/**
 * Some documentation
 *
 * @see https://example.org
 */
type Foo = string;

Running flowgen ./example.d.ts I get the following

(node:16376) ExperimentalWarning: The fs.promises API is experimental

    ts.SyntaxKind[type.kind]: JSDocNameReference
    name:
    kind: 303
    type: JSDocNameReference { pos: 38,
  end: 38,
  flags: 12582912,
  modifierFlagsCache: 0,
  transformFlags: 0,
  kind: 303,
  name:
   Identifier { pos: 38,
     end: 38,
     flags: 12648448,
     modifierFlagsCache: 0,
     transformFlags: 0,
     kind: 78,
     originalKeywordKind: undefined,
     escapedText: '' } }

: /* NO PRINT IMPLEMENTED: JSDocNameReference */ any
Parsing example
{ SyntaxError: Unterminated regular expression. (11:4)
   9 |  * Some documentation
  10 |  * @see : /* NO PRINT IMPLEMENTED: JSDocNameReference */ any
> 11 |  */
     |    ^
  12 | declare type Foo = string;
    at ir ([...]/node_modules/prettier/parser-babel.js:22:7277)
    at En ([...]/node_modules/prettier/parser-babel.js:22:66392)
    at Object.parse ([...]/node_modules/prettier/parser-babel.js:22:332006)
    at Object.parse$a [as parse] ([...]/node_modules/prettier/index.js:13684:19)
    at coreFormat ([...]/node_modules/prettier/index.js:15215:16)
    at formatWithCursor$1 ([...]/node_modules/prettier/index.js:15455:14)
    at args ([...]/node_modules/prettier/index.js:60228:12)
    at Object.format ([...]/node_modules/prettier/index.js:60248:12)
    at beautify ([...]/node_modules/flowgen/lib/cli/beautifier.js:11:28)
    at outputFile ([...]/node_modules/flowgen/lib/cli/runner.js:40:38)
  loc: { start: { line: 11, column: 4 } },
  codeFrame:
   '\u001b[0m \u001b[90m  9 |\u001b[39m \u001b[90m * Some documentations\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 10 |\u001b[39m \u001b[90m * @see : /* NO PRINT IMPLEMENTED: JSDocNameReference */\u001b[39m any\u001b[0m\n\u001b[0m\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 11 |\u001b[39m  \u001b[33m*\u001b[39m\u001b[33m/\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m    |\u001b[39m    \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 12 |\u001b[39m declare type \u001b[33mFoo\u001b[39m \u001b[33m=\u001b[39m string\u001b[33m;\u001b[39m\u001b[0m' }

Removing the @see from the docstring fixes the issue.

flowgen --version
1.14.1

node --version
v10.16.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant