Skip to content

Commit c83470d

Browse files
committed
Add a test case for TypeScript 3.7 getters/setters
1 parent 39f7798 commit c83470d

File tree

14 files changed

+213
-0
lines changed

14 files changed

+213
-0
lines changed

build-tests/api-documenter-test/etc/api-documenter-test.api.json

+56
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,32 @@
353353
},
354354
"isStatic": false
355355
},
356+
{
357+
"kind": "Property",
358+
"canonicalReference": "api-documenter-test!DocClass1#readonlyProperty:member",
359+
"docComment": "",
360+
"excerptTokens": [
361+
{
362+
"kind": "Content",
363+
"text": "get readonlyProperty(): "
364+
},
365+
{
366+
"kind": "Content",
367+
"text": "string"
368+
},
369+
{
370+
"kind": "Content",
371+
"text": ";"
372+
}
373+
],
374+
"releaseTag": "Public",
375+
"name": "readonlyProperty",
376+
"propertyTypeTokenRange": {
377+
"startIndex": 1,
378+
"endIndex": 2
379+
},
380+
"isStatic": false
381+
},
356382
{
357383
"kind": "Property",
358384
"canonicalReference": "api-documenter-test!DocClass1#regularProperty:member",
@@ -466,6 +492,36 @@
466492
"overloadIndex": 1,
467493
"parameters": [],
468494
"name": "tableExample"
495+
},
496+
{
497+
"kind": "Property",
498+
"canonicalReference": "api-documenter-test!DocClass1#writeableProperty:member",
499+
"docComment": "",
500+
"excerptTokens": [
501+
{
502+
"kind": "Content",
503+
"text": "get writeableProperty(): "
504+
},
505+
{
506+
"kind": "Content",
507+
"text": "string"
508+
},
509+
{
510+
"kind": "Content",
511+
"text": ";"
512+
},
513+
{
514+
"kind": "Content",
515+
"text": "\n\nset writeableProperty(value: string);"
516+
}
517+
],
518+
"releaseTag": "Public",
519+
"name": "writeableProperty",
520+
"propertyTypeTokenRange": {
521+
"startIndex": 1,
522+
"endIndex": 2
523+
},
524+
"isStatic": false
469525
}
470526
],
471527
"extendsTokenRange": {

build-tests/api-documenter-test/etc/api-documenter-test.api.md

+5
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,14 @@ export class DocClass1 extends DocBaseClass implements IDocInterface1, IDocInter
2626
malformedEvent: SystemEvent;
2727
// @eventProperty
2828
readonly modifiedEvent: SystemEvent;
29+
// (undocumented)
30+
get readonlyProperty(): string;
2931
regularProperty: SystemEvent;
3032
static sumWithExample(x: number, y: number): number;
3133
tableExample(): void;
34+
// (undocumented)
35+
get writeableProperty(): string;
36+
set writeableProperty(value: string);
3237
}
3338

3439
// @public

build-tests/api-documenter-test/etc/markdown/api-documenter-test.docclass1.md

+2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ The constructor for this class is marked as internal. Third-party code should no
2929
3030
| Property | Modifiers | Type | Description |
3131
| --- | --- | --- | --- |
32+
| [readonlyProperty](./api-documenter-test.docclass1.readonlyproperty.md) | | <code>string</code> | |
3233
| [regularProperty](./api-documenter-test.docclass1.regularproperty.md) | | <code>SystemEvent</code> | This is a regular property that happens to use the SystemEvent type. |
34+
| [writeableProperty](./api-documenter-test.docclass1.writeableproperty.md) | | <code>string</code> | |
3335
3436
## Methods
3537
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [api-documenter-test](./api-documenter-test.md) &gt; [DocClass1](./api-documenter-test.docclass1.md) &gt; [readonlyProperty](./api-documenter-test.docclass1.readonlyproperty.md)
4+
5+
## DocClass1.readonlyProperty property
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
get readonlyProperty(): string;
11+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [api-documenter-test](./api-documenter-test.md) &gt; [DocClass1](./api-documenter-test.docclass1.md) &gt; [writeableProperty](./api-documenter-test.docclass1.writeableproperty.md)
4+
5+
## DocClass1.writeableProperty property
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
get writeableProperty(): string;
11+
12+
set writeableProperty(value: string);
13+
```

build-tests/api-documenter-test/etc/yaml/api-documenter-test/docclass1.yml

+27
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ items:
2828
- 'api-documenter-test!DocClass1#interestingEdgeCases:member(1)'
2929
- 'api-documenter-test!DocClass1#malformedEvent:member'
3030
- 'api-documenter-test!DocClass1#modifiedEvent:member'
31+
- 'api-documenter-test!DocClass1#readonlyProperty:member'
3132
- 'api-documenter-test!DocClass1#regularProperty:member'
3233
- 'api-documenter-test!DocClass1.sumWithExample:member(1)'
3334
- 'api-documenter-test!DocClass1#tableExample:member(1)'
35+
- 'api-documenter-test!DocClass1#writeableProperty:member'
3436
- uid: 'api-documenter-test!DocClass1#deprecatedExample:member(1)'
3537
deprecated:
3638
content: Use `otherThing()` instead.
@@ -125,6 +127,17 @@ items:
125127
return:
126128
type:
127129
- 'api-documenter-test!SystemEvent:class'
130+
- uid: 'api-documenter-test!DocClass1#readonlyProperty:member'
131+
name: readonlyProperty
132+
fullName: readonlyProperty
133+
langs:
134+
- typeScript
135+
type: property
136+
syntax:
137+
content: 'get readonlyProperty(): string;'
138+
return:
139+
type:
140+
- string
128141
- uid: 'api-documenter-test!DocClass1#regularProperty:member'
129142
summary: This is a regular property that happens to use the SystemEvent type.
130143
name: regularProperty
@@ -174,6 +187,20 @@ items:
174187
type:
175188
- void
176189
description: ''
190+
- uid: 'api-documenter-test!DocClass1#writeableProperty:member'
191+
name: writeableProperty
192+
fullName: writeableProperty
193+
langs:
194+
- typeScript
195+
type: property
196+
syntax:
197+
content: |-
198+
get writeableProperty(): string;
199+
200+
set writeableProperty(value: string);
201+
return:
202+
type:
203+
- string
177204
references:
178205
- uid: 'api-documenter-test!DocBaseClass:class'
179206
name: DocBaseClass

build-tests/api-documenter-test/src/DocClass1.ts

+10
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,16 @@ export class DocClass1 extends DocBaseClass implements IDocInterface1, IDocInter
176176
return x;
177177
}
178178

179+
public get readonlyProperty(): string {
180+
return 'hello';
181+
}
182+
183+
public get writeableProperty(): string {
184+
return 'hello';
185+
}
186+
public set writeableProperty(value: string) {
187+
}
188+
179189
/**
180190
* This event is fired whenever the object is modified.
181191
* @eventProperty

build-tests/api-extractor-lib1-test/etc/api-extractor-lib1-test.api.md

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
//
99
// @public (undocumented)
1010
export class Lib1Class extends Lib1ForgottenExport {
11+
// (undocumented)
12+
readonly readonlyProperty: string;
13+
// (undocumented)
14+
writeableProperty: string;
1115
}
1216

1317
// @alpha (undocumented)

build-tests/api-extractor-lib1-test/src/index.ts

+9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ import { Lib1ForgottenExport } from './Lib1ForgottenExport';
1414

1515
/** @public */
1616
export class Lib1Class extends Lib1ForgottenExport {
17+
public get readonlyProperty(): string {
18+
return 'hello';
19+
}
20+
21+
public get writeableProperty(): string {
22+
return 'hello';
23+
}
24+
public set writeableProperty(value: string) {
25+
}
1726
}
1827

1928
/** @alpha */

build-tests/api-extractor-scenarios/etc/test-outputs/apiItemKinds/api-extractor-scenarios.api.json

+56
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,62 @@
450450
"overloadIndex": 1,
451451
"parameters": [],
452452
"name": "member"
453+
},
454+
{
455+
"kind": "Property",
456+
"canonicalReference": "api-extractor-scenarios!SimpleClass#readonlyProperty:member",
457+
"docComment": "",
458+
"excerptTokens": [
459+
{
460+
"kind": "Content",
461+
"text": "get readonlyProperty(): "
462+
},
463+
{
464+
"kind": "Content",
465+
"text": "string"
466+
},
467+
{
468+
"kind": "Content",
469+
"text": ";"
470+
}
471+
],
472+
"releaseTag": "Public",
473+
"name": "readonlyProperty",
474+
"propertyTypeTokenRange": {
475+
"startIndex": 1,
476+
"endIndex": 2
477+
},
478+
"isStatic": false
479+
},
480+
{
481+
"kind": "Property",
482+
"canonicalReference": "api-extractor-scenarios!SimpleClass#writeableProperty:member",
483+
"docComment": "",
484+
"excerptTokens": [
485+
{
486+
"kind": "Content",
487+
"text": "get writeableProperty(): "
488+
},
489+
{
490+
"kind": "Content",
491+
"text": "string"
492+
},
493+
{
494+
"kind": "Content",
495+
"text": ";"
496+
},
497+
{
498+
"kind": "Content",
499+
"text": "\n\nset writeableProperty(value: string);"
500+
}
501+
],
502+
"releaseTag": "Public",
503+
"name": "writeableProperty",
504+
"propertyTypeTokenRange": {
505+
"startIndex": 1,
506+
"endIndex": 2
507+
},
508+
"isStatic": false
453509
}
454510
],
455511
"implementsTokenRanges": []

build-tests/api-extractor-scenarios/etc/test-outputs/apiItemKinds/api-extractor-scenarios.api.md

+5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ export enum RegularEnum {
5757
export class SimpleClass {
5858
// (undocumented)
5959
member(): void;
60+
// (undocumented)
61+
get readonlyProperty(): string;
62+
// (undocumented)
63+
get writeableProperty(): string;
64+
set writeableProperty(value: string);
6065
}
6166

6267
// @public (undocumented)

build-tests/api-extractor-scenarios/etc/test-outputs/apiItemKinds/rollup.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ export declare enum RegularEnum {
5555
/** @public */
5656
export declare class SimpleClass {
5757
member(): void;
58+
get readonlyProperty(): string;
59+
get writeableProperty(): string;
60+
set writeableProperty(value: string);
5861
}
5962

6063
/** @public */

build-tests/api-extractor-scenarios/etc/test-outputs/bundledPackages/rollup.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export declare function f(arg1: Lib1Class, arg2: Lib2Class): void;
55

66
/** @public */
77
declare class Lib1Class extends Lib1ForgottenExport {
8+
readonly readonlyProperty: string;
9+
writeableProperty: string;
810
}
911

1012
declare class Lib1ForgottenExport {

build-tests/api-extractor-scenarios/src/apiItemKinds/classes.ts

+10
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,14 @@ export abstract class AbstractClass {
1111
export class SimpleClass {
1212
public member(): void {
1313
}
14+
15+
public get readonlyProperty(): string {
16+
return 'hello';
17+
}
18+
19+
public get writeableProperty(): string {
20+
return 'hello';
21+
}
22+
public set writeableProperty(value: string) {
23+
}
1424
}

0 commit comments

Comments
 (0)