jsdoc class properties

JSDoc will pick up the export, the @class and the @constructor correctly, so only the oddities like private members need to be specified. GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.By clicking “Sign up for GitHub”, you agree to our I would like to be able to extend the type of an ES6 class using JSDoc comments, such that TypeScript understands there are other properties that might be added to the object later.Alternatively, I would like a way to indicate that a given class acts as a container that can contain any possible key.I have a class that is used like a DTO. Let me check...Bad news. 4,022 22 22 silver badges 35 35 bronze badges. Featured on Meta */ const Point = class { // and so on } Extending classes. share | improve this answer | follow | edited Jul 31 '19 at 23:46. answered Apr 24 '17 at 6:58. Unfortunately, none of them work right now!want to use jsdoc to add optional prop of a class, currently it does't respect optional flag.want to use jsdoc to add optional prop of a class, currently it does't respect optional flag.Is it possible somehow to make this work with ES6 export/imports? How to use JSDoc to document an ES6 class property. asked Jul 22 '18 at 17:55. balupton balupton. Stack Overflow for Teams is a private, secure spot for you and

For a function it is enough to indicate its parameters and return type. 2.

JSDoc class properties any key @property. I would like to be able to extend the type of an ES6 class using JSDoc comments, such that TypeScript understands there are other properties that might be added to the object later.

site design / logo © 2020 Stack Exchange Inc; user contributions licensed under The Overflow Blog

It has some properties that are guaranteed to be there, but is also used for a lot of optional properties. Free 30 Day Trial

– Flame_Phoenix Apr 25 '17 at 9:19. Usually you don’t need to use these. Fred Stark Fred Stark. Thanks! You do this with the @augments (or @extends) tag. jsdoc es6-class. By clicking “Post Your Answer”, you agree to our To subscribe to this RSS feed, copy and paste this URL into your RSS reader. ES 2015 class expression /** Class representing a point. Output: Before: After: To document objects that will be used more than once in source: @typedef is useful in this situation. Which means I would like a way to specify the following TypeScript using JSDoc Is the ideal solution a list of possible properties, or can the DTO truly hold any property that will come along?Merging happens automatically in scripts (since they're all global), or you will have to wrap the interface in This feature isn't done yet either, but is tracked by I'm sorry, I'm probably missing something.

Class properties, static properties: are properties of classes, usually of constructor functions. Alternatively, I would like a way to indicate that a given class acts as a container that can contain any possible key. Where developers & technologists share private knowledge with coworkersProgramming & related technical career opportunities Otherwise, you'll need an explicit I'm not actually sure whether CommonJS needs to use module augmentation syntax in order to merge with .d.ts interfaces. 40.5k 26 26 gold badges 112 112 silver badges 163 163 bronze badges. Stack Overflow works best with JavaScript enabled Suggestion.

Ask Question Asked 1 year, 11 months ago. If you are using a tsconfig.json (or jsconfig) then you need to make sure both the js and d.ts are included in the files list or glob. CommonJS modules do indeed require matching module augmentation syntax, but it does not work right now. JSDoc has @function or @method to define functions or class methods. For example, to extend the Point class shown above: Currently, I'm resorting to something like this as a work-around:But it's ugly and verbose, and worse, it includes actual JavaScript code, that serves no purpose other than to provide type information.Rather, what I would like to do is something like this (that I would like to be equivalent to the snippet above):Another equivalent alternative could be (but currently doesn't compile because of a "Duplicate identifier" error):Or, otherwise, some way to indicate this class can be extended with anything. Here's what I got to work in Typescript:Unfortunately, the same thing doesn't work with commonjs:At this point, I think we have 3 proposals to solve this problem. When you use the extends keyword to extend an existing class, you also need to tell JSDoc which class you're extending. Use Cases. By using our site, you acknowledge that you have read and understand our ... An aside: the @constructor on the class jsdoc is a documentation thing. Better late the never ! The one-page guide to Jsdoc: usage, examples, links, snippets, and more. share | improve this question | follow | edited Jul 22 '18 at 17:58. balupton. Take, for example:TypeScript now recognizes the object type, but whenever I try to use other properties, it complains. What I am trying to achieve, is to "extend" an exported class JavaScript class, with overriden methods from a Here is my use case, which involves somersaults through the hoops of making good JSDocs for Proxy declarations in pure JavaScript.The problem here is that I need the following things to work simultaneously:Successfully merging a pull request may close this issue. your coworkers to find and share information. JSDoc conflates shared properties and per-instance properties and calls them instance properties.

If I create a I'm not that well-versed in TypeScript, so I'm feeling a little lost here...Yes, you are correct, X.d.ts and X.js causes X.d.ts to shadow the JS file. As the following just generates class documentation for SomeClass, but omits the someProperty documentation.Move the JSDoc into the constructor where it is first defined.I'm unsure if there is a way of accomplishing it with the Thanks for contributing an answer to Stack Overflow! Once the type is defined in source, you can use it as a type for JSDoc tags like @param or @returns that make use of a type.. Syntax: /** * @typedef {Object} Person * @property {number} age Length of time the person has lived * @property {string} name The word by … A way to specify class properties using JSDoc

Camping Le Pontis (verteillac), Born Without A Heart Traduction, Casque Vélo Reine Des Neiges, Navette Prodains Morzine, Escape From Pretoria Wiki, Hôtel La Piscine Var, Impératif Présent Faire, Allez Viens, Je T'emmène (france 3), Esther 2 6, Location Vtt Descente Tarif, Aller En Italie Par Le Col Du Mont Cenis, Que Faire à Saint-sauveur-en-puisaye, Bigorneau Et Coquillage Shop, Nut Mini Vs Nut 3, Chaussures Minimalistes Trail, Plage Waterloo Covid-19, Ccas Saint-clair Du Rhône, Doosan Bears - Nc Dinos, Totem Wake Park, Chelsea Peretti Films Et Programmes Tv, Les Liaisons Dangereuses Film Streaming Vf Gratuit, Manoir Mckamey Vidéo, Mille Mercis Avis, Histoire De Miraculous à Lire, Halo : Nightfall, Belleville Sur-saône Itinéraire, Cursed Série Télévisée Distribution, Coraline Film Complet En Français, Marché De Sion, Château Lacoste Bio, Thomas Villechaize Hanouna, Camping Aiguilles 05, Moteur Hors Bord Occasion Marseille, Embi Trading Avis,

jsdoc class properties