Skip to content

Commit

Permalink
[api-extractor] cleanup and verify static readonly case
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallstock committed May 23, 2022
1 parent b9d1d35 commit 48e4046
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 6 deletions.
28 changes: 28 additions & 0 deletions build-tests/api-documenter-test/etc/api-documenter-test.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,34 @@
},
"isStatic": false
},
{
"kind": "Property",
"canonicalReference": "api-documenter-test!DocClass1.staticReadonlyThing:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "static readonly staticReadonlyThing: "
},
{
"kind": "Content",
"text": "boolean"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "staticReadonlyThing",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": true
},
{
"kind": "Method",
"canonicalReference": "api-documenter-test!DocClass1.sumWithExample:member(1)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export class DocClass1 extends DocBaseClass implements IDocInterface1, IDocInter
// (undocumented)
get readonlyProperty(): string;
regularProperty: SystemEvent;
// (undocumented)
static readonly staticReadonlyThing: boolean;
static sumWithExample(x: number, y: number): number;
tableExample(): void;
// (undocumented)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The constructor for this class is marked as internal. Third-party code should no
| --- | --- | --- | --- |
| [readonlyProperty](./api-documenter-test.docclass1.readonlyproperty.md) | <code>readonly</code> | string | |
| [regularProperty](./api-documenter-test.docclass1.regularproperty.md) | | [SystemEvent](./api-documenter-test.systemevent.md) | This is a regular property that happens to use the SystemEvent type. |
| [staticReadonlyThing](./api-documenter-test.docclass1.staticreadonlything.md) | <code>static</code><code>readonly</code> | boolean | |
| [writeableProperty](./api-documenter-test.docclass1.writeableproperty.md) | | string | |
| [writeonlyProperty](./api-documenter-test.docclass1.writeonlyproperty.md) | | string | API Extractor will surface an <code>ae-missing-getter</code> finding for this property. |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [api-documenter-test](./api-documenter-test.md) &gt; [DocClass1](./api-documenter-test.docclass1.md) &gt; [staticReadonlyThing](./api-documenter-test.docclass1.staticreadonlything.md)

## DocClass1.staticReadonlyThing property

<b>Signature:</b>

```typescript
static readonly staticReadonlyThing: boolean;
```
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ properties:
content: 'regularProperty: SystemEvent;'
return:
type: '<xref uid="api-documenter-test!SystemEvent:class" />'
- name: staticReadonlyThing
uid: 'api-documenter-test!DocClass1.staticReadonlyThing:member'
package: api-documenter-test!
fullName: staticReadonlyThing
summary: ''
remarks: ''
example: []
isPreview: false
isDeprecated: false
syntax:
content: 'static readonly staticReadonlyThing: boolean;'
return:
type: boolean
- name: writeableProperty
uid: 'api-documenter-test!DocClass1#writeableProperty:member'
package: api-documenter-test!
Expand Down
2 changes: 2 additions & 0 deletions build-tests/api-documenter-test/src/DocClass1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ export class DocClass1 extends DocBaseClass implements IDocInterface1, IDocInter
super();
}

static readonly staticReadonlyThing: boolean;

/**
* This is an overloaded function.
* @param a - the first string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,12 @@
},
{
"kind": "Property",
"canonicalReference": "api-extractor-scenarios!MyClass#declaredReadonlyThing:member",
"canonicalReference": "api-extractor-scenarios!MyClass.declaredReadonlyThing:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "readonly declaredReadonlyThing: "
"text": "static readonly declaredReadonlyThing: "
},
{
"kind": "Reference",
Expand All @@ -342,7 +342,7 @@
"startIndex": 1,
"endIndex": 2
},
"isStatic": false
"isStatic": true
},
{
"kind": "Property",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface _IInternalThing {
// @public (undocumented)
export class MyClass {
// (undocumented)
readonly declaredReadonlyThing: _IInternalThing;
static readonly declaredReadonlyThing: _IInternalThing;
// (undocumented)
get _onlyHasGetterThing(): _IInternalThing;
tsDocReadonlyThing: _IInternalThing;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export declare class MyClass {
get _writableThing(): _IInternalThing;
set _writableThing(value: _IInternalThing);
get _onlyHasGetterThing(): _IInternalThing;
readonly declaredReadonlyThing: _IInternalThing;
static readonly declaredReadonlyThing: _IInternalThing;
/**
* Technically isn't but for testing purposes
* @readonly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class MyClass {
return { title: 'thing' };
}

readonly declaredReadonlyThing: _IInternalThing;
static readonly declaredReadonlyThing: _IInternalThing;

/**
* Technically isn't but for testing purposes
Expand Down

0 comments on commit 48e4046

Please sign in to comment.