microsoft / TypeScript-Handbook

Deprecated, please use the TypeScript-Website repo instead
https://github.com/microsoft/TypeScript-Website
Apache License 2.0
4.88k stars 1.13k forks source link

Document JSDoc examples with decorators #1084

Open edjm1971 opened 5 years ago

edjm1971 commented 5 years ago

Suggestion

I would like to see your page https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html#supported-jsdoc updated to reflect what the proper format is for comments when annotations are in use.

Examples

The only example I can find out on the web with comments and annotations is on the Comdoc site https://compodoc.app/guides/jsdoc-tags.html which would be the 1st entry below.

/**
 * Description.
 */
@Component({...})
class MyClass{...}

Or would this be written as

@Component({...})
/**
 * Description.
 */
class MyClass{...}
orta commented 5 years ago

It looks like it's the first one only

/** You should see this when you hover on greeter */
@sealed
class Greeter {}

@sealed
/** You won't see this when you hover on greeter */
class GreeterTwo {}

function sealed(constructor: Function) {
  Object.seal(constructor);
  Object.seal(constructor.prototype);
}

Playground link.

Would you like to send a PR to our Handbook adding that example?