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

Unable to Test First Example on tsdoc.org Playground #437

Open
dev-mcpd opened this issue Jan 7, 2025 · 2 comments
Open

Unable to Test First Example on tsdoc.org Playground #437

dev-mcpd opened this issue Jan 7, 2025 · 2 comments

Comments

@dev-mcpd
Copy link

dev-mcpd commented Jan 7, 2025

Hi TSDoc Team!

I couldn't test the very first example on tsdoc.org's site. It generates an error because it starts with a class instead of a comment. Was this the expected behavior?

Thank you for your attention.

export class Statistics {
  /**
   * Returns the average of two numbers.
   *
   * @remarks
   * This method is part of the {@link core-library#Statistics | Statistics subsystem}.
   *
   * @param x - The first input number
   * @param y - The second input number
   * @returns The arithmetic mean of `x` and `y`
   *
   * @beta
   */
  public static getAverage(x: number, y: number): number {
    return (x + y) / 2.0;
  }
}
(1,1): Expecting a leading "/**"

Best regards,
@cesardddp

@octogonz
Copy link
Collaborator

octogonz commented Jan 7, 2025

The TSDoc Playground does not include a full JavaScript parser. It simply assumes that the first text it encounters is a /** comment, and ignores everything after the last */.

The error message (1,1): Expecting a leading "/**" seemed reasonable clear to me. Assuming we're not going to implement a JavaScript parser, how would you improve it?

@cesardddp
Copy link

Oh... thank you, so I really misunderstood the purpose of the TSDoc Playground.

Maybe this might be a bit confusing for other new users, as it was for me, the fact that the first example fails right away... Or maybe new users like me shouldn't be here haha.

I would just include this in a helper on the playground page to make it clearer that it's not a full JS parser. But considering that this documentation is not for more novice users, this concern might not make sense for this project.

Thank you for your time!

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

3 participants