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

Weirdly placed @deprecated comments in dist/cannon-es.js #89

Closed
YouRik opened this issue Apr 12, 2021 · 0 comments · Fixed by #123
Closed

Weirdly placed @deprecated comments in dist/cannon-es.js #89

YouRik opened this issue Apr 12, 2021 · 0 comments · Fixed by #123

Comments

@YouRik
Copy link

YouRik commented Apr 12, 2021

Editors like VS Code parse the comments from source code and display them during editing.

Through this I realized that the constructors of classes like "World" and "Body" are falsely shown as deprecated because the comments above their constructors seem to be weirdly positioned or not correctly formatted. One example:
dist/cannon-es.js
line 3154

/**
 * Base class for all body types.
 * @example
 *     const body = new Body({
 *       mass: 1,
 *     })
 *     const shape = new Sphere(1)
 *     body.addShape(shape)
 *     world.addBody(body)
 */
class Body extends EventTarget {

line 3224

  /**
   * Callback function that is used BEFORE stepping the system. Use it to apply forces, for example. Inside the function, "this" will refer to this Body object. Deprecated - use World events instead.
   * @deprecated Use World events instead
   */

  /**
   * Callback function that is used AFTER stepping the system. Inside the function, "this" will refer to this Body object. Deprecated - use World events instead.
   * @deprecated Use World events instead
   */

line 3379

  /**
   * When true the body behaves like a trigger. It does not collide
   * with other bodies but collision events are still triggered.
   * @default false
   */
  constructor(options = {}) {

The comments from line 3224 seem to be misinterpreted and falsely mark the constructor signatures as deprecated.

Steps to reproduce:

  1. Use Visual Studio Code
  2. Import dist/cannon-es.js into another script
  3. Use constructor of Body or World
  4. Constructor signature is falsely marked as deprecated

If these comments are removed, the constructor is no longer seen as deprecated. As such, I suggest reformatting such comments to make it clear that they are not referring to the constructor signature but to the respective fields.

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

Successfully merging a pull request may close this issue.

1 participant