Tips for effectively documenting interface properties within compodoc for Angular 2

Recently, I started using compodoc to document my app and I am facing some challenges in writing clean code while documenting the openWeather API interface.

I attempted to use the conventional @property JSDoc marker but it does not seem to work well with compodoc. In order to achieve the desired outcome, I had to structure it like this:

/**
 * Weather information
 */
interface CityWeather {
  /**
   * Weather condition id
   */
  id: number;

  /**
   * Group of weather parameters (Rain, Snow, Extreme etc.)
   */
  main: string;

  /**
   * Weather condition within the group
   */
  description: string;

  /**
   * Weather icon id
   */
  icon: string;
}

I prefer to have the comments only at the beginning of the code rather than above each property, similar to the older JSDoc @property {type} [name]. Is there a cleaner or more efficient way to do this?

/**
 * Weather information
 *
 * @property id Weather condition id
 * @property main Group of weather parameters (Rain, Snow, Extreme etc.)
 * @property description Weather condition within the group
 * @property icon Weather icon id
 */
interface CityWeather {
  id: number;
  main: string;
  description: string;
  icon: string;
}

A Small Edit from my end

You can streamline the comments by keeping everything within a one-line /** */, like so:

/** Weather information */
export interface CityWeather {
  /** Weather condition id */
  id: number;

  /** Group of weather parameters (Rain, Snow, Extreme etc.) */
  main: string;

  /** Weather condition within the group */
  description: string;

  /** Weather icon id */
  icon: string;
}

Answer №1

At this time, there is no support for this functionality; however, a feature request has been submitted in the compodoc GitHub issues.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Error: Query is not valid

I'm encountering an error when trying to run this query, and I'm not sure why it's returning a bad request. My goal is to fetch a specific user from the database using the accountId. Can someone assist me with this issue? Below is the funct ...

Customizing the appearance of antd Button using emotion and typescript

I've been attempting to customize an antd Button component using emotion in TypeScript, but I encountered an error when trying to implement the styled Button. The error message I received was: Type '{ children: never[]; }' is not assignab ...

Dealing with null-safe operators issues has been a challenge for me, especially while working on my Mac using

Hey everyone! I'm encountering errors when using null sage operators in TypeScript. Can someone help me figure out how to solve this issue? By the way, I'm working on Visual Studio Code for Mac. https://i.stack.imgur.com/huCns.png ...

I'm looking for the configuration of function definitions for the Jasmine npm module within an Angular project. Can

When a new Angular project is created, the *.spec.ts files provide access to Jasmine functions such as "describe", "beforeEach", and expect. Despite not having an import clause for them in spec.ts files, I can click on these functions and navigate to their ...

What is the best way to specify types for a collection of objects that all inherit from a common class?

I am new to typescript and may be asking a beginner question. In my scenario, I have an array containing objects that all extend the same class. Here is an example: class Body{ // implementation } class Rectangle extends Body{ // implementation } class ...

I am facing an issue with the asynchronous function as it is displaying an error message

**I am facing an issue with displaying categories. I have attempted to do this using async function, however the data is not showing up** <div class="form-group"> <label for="category">Category</label> <select id="categor ...

Arranging React Grid Items with Stylish Overlapping Layout

Is there a way to create a react-grid-layout with 100 grid points width, while ensuring that the grid items do not overlap? https://i.sstatic.net/CQiVh.png (Reducing the number of columns can prevent overlap, but sacrifices the 100-point width resolution ...

Utilize the "Required" directive within a nested property

If I have a TypeScript type defined as follows: type State = { one?: string; two?: { three?: { four?: string; five?: string; six: number }, seven: string } } Is there a way to create a new type based on State where only ...

How can I access a component variable within the styles in Angular?

Is it possible to utilize a variable width in my Angular 5 component template? I would like to achieve something similar to this: <style> input:checked + .slider:before { transform: translateX({{width}}px); } </style> The &apo ...

Can you identify the TypeScript type for an array containing various Angular components?

In my application, I have a diverse range of components that I would like to organize into an array. There are no restrictions on what types of components can be included in this array, as long as they are Angular components. What is the correct way to de ...

Error caused by CORS Policy blocking XMLHttpRequest access (Python/Angular)

I've encountered a troubling issue with my Angular application, currently live on the web. Users are unable to log in due to this issue, and those who are already logged in are experiencing issues while using the website. The error message reads: Acc ...

What could be the reason for `process.env.myvariable` not functioning in a Next.js project with TypeScript

After creating a file called .env.local in the root directory of my project, I added a variable called WEBSOCKET_VARIABLE=THIS_IS_TEXT to it. However, when I try to access it using process.env.WEBSOCKET_VARIABLE, nothing is found. What could be causing ...

Choose the "toolbar-title" located within the shadow root of ion-title using CSS

Within Ionic, the ion-title component contains its content wrapped in an additional div inside the shadow-dom. This particular div is designated with the class .toolbar-title. How can I target this div using a SCSS selector to modify its overflow behavior? ...

Displaying the contents of a slot in various locations within a web component

The Challenge I am currently utilizing Angular and its Angular Elements to produce Webcomponents. My goal is to allow clients the flexibility to pass custom icons into slots, enabling them to control the appearance of the icons being used. However, this ...

Effortlessly control your CSS within extensive Angular 2/4/5 projects

When working in Angular, I typically organize my CSS on a component basis with some global styling in styles.css. However, I'm looking for a better way to easily update CSS in the future. I want to be able to make changes in one place and see them ref ...

Angular 2: Troubleshooting Issues with Observable Data Display

Looking to implement a RESTful call with Angular 2 that constantly updates whenever there are changes in the API. In my service, I've included an Observable to fetch data from the API: getData(): Observable<any[]> { return this.http.get(url) ...

Passing an observable from parameters to a pipe in RxJS: A guide

Can someone help me with writing a TypeScript function like the one below: function abc(arg1, arg2, arg3) { pipe(arg1, arg2, arg3...); // or someSubject.pipe(arg1, arg2, arg3..) } I keep getting errors when trying to build the code. How can I success ...

How to effectively handle null in Typescript when accessing types with index signatures unsafely

Why am I getting an error that test might be potentially undefined even though I've enabled strictNullCheck in my tsconfig.json file? (I'm unsure of the keys beforehand) const a: Record<string, {value: string}> = {} a["test"].va ...

Exploring the capabilities of Angular2 in non-browser environments

I am currently exploring the development of an Angular2 application that can operate in two separate ways - one being within Electron and the other through the CLI. The core components of the application are essentially a series of services. In the Electr ...

The body content of the webpage needs to be updated without altering the header and footer, all while avoiding a page

On my website, I have a header menu that includes buttons for "home" and "about us." The default page is set to the home page. Within the home page, there is a specific link. When this link on the home page or the "about us" button is clicked, I want the ...