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

[api-extractor] Handling excerptTokens with curly braces #1249

Open
natalieethell opened this issue Apr 25, 2019 · 1 comment
Open

[api-extractor] Handling excerptTokens with curly braces #1249

natalieethell opened this issue Apr 25, 2019 · 1 comment
Labels
bug Something isn't working as intended effort: easy Probably a quick fix. Want to contribute? :-) help wanted If you're looking to contribute, this issue is a good place to start!

Comments

@natalieethell
Copy link
Contributor

Api-extractor doesn't seem to correctly handle the case in which an extends block has open and closed curly braces within it. For example, take an interface with the following declaration:

export interface A extends B<C & {d: D}> {
  ...
}

Since nodeToStopAt is defined as '{' for interfaces, the excerptTokens written to the api.json file end at '&', instead of after '>'.

In addition, the extendsTokenRanges in the api.json file we're getting for this interface look a little strange:

"extendsTokenRanges": [
  {
    "startIndex": 0,
    "endIndex": 0
  },
  {
    "startIndex": 0,
    "endIndex": 0
  }
]
@octogonz octogonz added bug Something isn't working as intended effort: easy Probably a quick fix. Want to contribute? :-) help wanted If you're looking to contribute, this issue is a good place to start! labels Apr 25, 2019
@octogonz
Copy link
Collaborator

We should definitely fix this.

Currently the end token is specified using nodeToStopAt which is a ts.SyntaxKind. Maybe it should be an actual node.

octogonz added a commit that referenced this issue Apr 30, 2019
… extends B<{c: C}> { }" to "interface A extends B<{" because it stopped at the first "{" encountered, even if it was not an immediate child in the AST
javier-garcia-meteologica pushed a commit to javier-garcia-meteologica/rushstack that referenced this issue Jun 26, 2020
…terface A extends B<{c: C}> { }" to "interface A extends B<{" because it stopped at the first "{" encountered, even if it was not an immediate child in the AST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended effort: easy Probably a quick fix. Want to contribute? :-) help wanted If you're looking to contribute, this issue is a good place to start!
Projects
Status: AE/AD
Development

No branches or pull requests

2 participants