1"use strict";(self.webpackChunkapi_extractor_com=self.webpackChunkapi_extractor_com||[]).push([[9784],{5212:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var n=r(6443),a=r(8338),o=(r(829),r(5552)),s=["components"],i={title:"ae-setter-with-docs"},l=void 0,p={unversionedId:"pages/messages/ae-setter-with-docs",id:"pages/messages/ae-setter-with-docs",title:"ae-setter-with-docs",description:'"The doc comment for the property \\\\\\ must appear on the getter, not the setter."_',source:"@site/docs/pages/messages/ae-setter-with-docs.md",sourceDirName:"pages/messages",slug:"/pages/messages/ae-setter-with-docs",permalink:"/pages/messages/ae-setter-with-docs",draft:!1,editUrl:"https://github.com/microsoft/rushstack-websites/tree/main/websites/api-extractor.com/docs/pages/messages/ae-setter-with-docs.md",tags:[],version:"current",frontMatter:{title:"ae-setter-with-docs"},sidebar:"docsSidebar",previous:{title:"ae-preapproved-unsupported-type",permalink:"/pages/messages/ae-preapproved-unsupported-type"},next:{title:"ae-unresolved-inheritdoc-base",permalink:"/pages/messages/ae-unresolved-inheritdoc-base"}},c={},u=[{value:"Remarks",id:"remarks",level:2},{value:"How to fix",id:"how-to-fix",level:2},{value:"See also",id:"see-also",level:2}],m={toc:u},g="wrapper";function d(e){var t=e.components,r=(0,a.A)(e,s);return(0,o.yg)(g,(0,n.A)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,o.yg)("head",null,(0,o.yg)("link",{rel:"canonical",href:"https://api-extractor.com/pages/pages/messages/ae-setter-with-docs/"})),(0,o.yg)("p",null,(0,o.yg)("em",{parentName:"p"},'"The doc comment for the property ',"_","_","_",' must appear on the getter, not the setter."')),(0,o.yg)("h2",{id:"remarks"},"Remarks"),(0,o.yg)("p",null,'API Extractor models a property getter/setter pair as a single API item. The getter is the main declaration,\nand the setter is treated as an "ancillary" signature. Only the getter can have a doc comment. If a doc comment\nis found on the setter, then API Extractor reports the ',(0,o.yg)("inlineCode",{parentName:"p"},"ae-setter-with-docs")," error."),(0,o.yg)("p",null,"Example:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-ts"},"/**\n * Represents a book from the catalog.\n * @public\n */\nexport class Book {\n private _title: string = 'untitled';\n\n /**\n * Gets the title of the book.\n */\n public get title(): string {\n return this._title;\n }\n\n /**\n * Sets the title of the book.\n */\n // Error: (ae-setter-with-docs) The doc comment for the property \"title\" must appear\n // on the getter, not the setter.\n public set title(value: string) {\n this._title = value;\n }\n}\n")),(0,o.yg)("h2",{id:"how-to-fix"},"How to fix"),(0,o.yg)("p",null,"Remove the doc comment from the setter. Describe both options in the getter's doc comment:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-ts"},"/**\n * Represents a book from the catalog.\n * @public\n */\nexport class Book {\n private _title: string = 'untitled';\n\n /**\n * Gets or sets the title of the book.\n */\n public get title(): string {\n return this._title;\n }\n\n public set title(value: string) {\n this._title = value;\n }\n}\n")),(0,o.yg)("h2",{id:"see-also"},"See also"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("a",{parentName:"li",href:"/pages/messages/ae-missing-getter"},"ae-missing-getter"))))}d.isMDXComponent=!0},5552:(e,t,r)=>{r.d(t,{xA:()=>c,yg:()=>d});var n=r(829);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){a(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEac
1h(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},g=n.forwardRef(function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(r),g=a,d=u["".concat(l,".").concat(g)]||u[g]||m[g]||o;return r?n.createElement(d,s(s({ref:t},c),{},{components:r})):n.createElement(d,s({ref:t},c))});function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=g;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:a,s[1]=i;for(var p=2;p<o;p++)s[p]=r[p];return n.createElement.apply(null,s)}return n.createElement.apply(null,r)}g.displayName="MDXCreateElement"}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.