webdoc-labs / webdoc

Documentation generator for the web
https://www.webdoclabs.com
Other
79 stars 9 forks source link

Add isTSTypeAliasDeclaration in extractSymbol #192

Closed SuperSodaSea closed 2 years ago

SuperSodaSea commented 2 years ago

Should fix [DocParser]: Failed to parse doc for (@Unnamed) caused by /** ... */ type Foo = {}.

See also: https://github.com/pixijs/pixijs/issues/8720

ShukantPal commented 2 years ago

This does fix the warning but not the spirit of the issue :D. I'll check this out tonight and make it also parse the type definition properties

SuperSodaSea commented 2 years ago

@ShukantPal I'll wait patiently :)

ShukantPal commented 2 years ago
Screen Shot 2022-10-22 at 6 12 56 PM

Added the data type to the TypeDef document signatures (with formatting!)

SuperSodaSea commented 2 years ago

@ShukantPal I tried to bump @webdoc/cli to 2.2.0 in pixi.js and got errors like this:

[Indexer]: Parameter node couldn't be parsed, enable warning logs for more detail
Node {
  type: 'TSCallSignatureDeclaration',
  start: 1332,
  end: 1369,
  loc: SourceLocation {
    start: Position { line: 67, column: 4, index: 1332 },
    end: Position { line: 67, column: 41, index: 1369 },
    filename: undefined,
    identifierName: undefined
  },
  typeParameters: undefined,
  parameters: [
    Node {
      type: 'Identifier',
      start: 1333,
      end: 1347,
      loc: [SourceLocation],
      name: 'urlStr',
      typeAnnotation: [Node]
    }
  ],
  typeAnnotation: Node {
    type: 'TSTypeAnnotation',
    start: 1348,
    end: 1368,
    loc: SourceLocation {
      start: [Position],
      end: [Position],
      filename: undefined,
      identifierName: undefined
    },
    typeAnnotation: Node {
      type: 'TSTypeReference',
      start: 1350,
      end: 1368,
      loc: [SourceLocation],
      typeName: [Node]
    }
  }
}
***unknown (typescript) data-type node***
Node {
  type: 'TSCallSignatureDeclaration',
  start: 1374,
  end: 1477,
  loc: SourceLocation {
    start: Position { line: 68, column: 4, index: 1374 },
    end: Position { line: 68, column: 107, index: 1477 },
    filename: undefined,
    identifierName: undefined
  },
  typeParameters: undefined,
  parameters: [
    Node {
      type: 'Identifier',
      start: 1375,
      end: 1389,
      loc: [SourceLocation],
      name: 'urlStr',
      typeAnnotation: [Node]
    },
    Node {
      type: 'Identifier',
      start: 1391,
      end: 1426,
      loc: [SourceLocation],
      name: 'parseQueryString',
      typeAnnotation: [Node]
    },
    Node {
      type: 'Identifier',
      start: 1428,
      end: 1455,
      loc: [SourceLocation],
      name: 'slashesDenoteHost',
      optional: true,
      typeAnnotation: [Node]
    }
  ],
  typeAnnotation: Node {
    type: 'TSTypeAnnotation',
    start: 1456,
    end: 1476,
    loc: SourceLocation {
      start: [Position],
      end: [Position],
      filename: undefined,
      identifierName: undefined
    },
    typeAnnotation: Node {
      type: 'TSTypeReference',
      start: 1458,
      end: 1476,
      loc: [SourceLocation],
      typeName: [Node]
    }
  }
}
***unknown (typescript) data-type node***
...

Seems to be code here: https://github.com/pixijs/pixijs/blob/3ba43e50030641e2cb028c7c265e80ce0fdf6fff/packages/utils/src/url.ts#L66-L80

ShukantPal commented 1 year ago

I added parsing for namee method signatures but not call signatures - this would be a new PR :D

SuperSodaSea commented 1 year ago

Just in case, don't forget about the ArrayPattern :)

ShukantPal commented 1 year ago

@SuperSodaSea haven't forgotten about this. Prolly need a couple weeks to finish that part