Skip to content

Commit

Permalink
fix: add prop tables for type alias
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Mar 26, 2020
1 parent bc45094 commit 6c99842
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 123 deletions.
18 changes: 8 additions & 10 deletions core/specification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- [Overview](#overview)
- [Installation](#installation)
- [API](#api)
- [run](#run)
- [RectDocgenTypescriptOptions](#rectdocgentypescriptoptions)

# Overview

Expand All @@ -23,19 +23,17 @@ $ npm install @component-controls/specification --save-dev

<!-- START-TSDOC-TYPESCRIPT -->

## run
## RectDocgenTypescriptOptions

run API to generate react-docgen-typescript props information tables.
a callback to transfor them props table and the options to be passd to react-docgen-typescript.

_defined in [@component-controls/specification/src/test.ts](https://github.com/ccontrols/component-controls/tree/master/core/specification/src/test.ts#L6)_

**run**(`options`: undefined | string): number;
### properties

### parameters

| Name | Type | Description |
| --------- | ------------------- | ------------------------------------------------------- |
| `options` | undefined \| string | configuration options |
| `returns` | number | a callable function of type PropsInfoExtractorFunction |
| Name | Type | Description |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------- |
| `transformProps` | undefined \| (`props`\*: [ComponentDoc](#componentdoc)\[]): [ComponentDoc](#componentdoc); | callback to transform the props table |
| `ParserOptions` | [ParserOptions](#parseroptions) | |

<!-- END-TSDOC-TYPESCRIPT -->
15 changes: 9 additions & 6 deletions core/specification/src/test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { ParserOptions, ComponentDoc } from 'react-docgen-typescript';

/**
* run API to generate react-docgen-typescript props information tables.
* @param options configuration options
* @returns a callable function of type PropsInfoExtractorFunction
* a callback to transfor them props table and the options to be passd to react-docgen-typescript.
*/
export const run = (options?: string): number => {
return parseInt(options || '');
};
export type RectDocgenTypescriptOptions = {
/**
* callback to transform the props table
*/
transformProps?: (props: ComponentDoc[]) => ComponentDoc;
} & ParserOptions;
176 changes: 120 additions & 56 deletions core/specification/tmp-out-typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,77 +17,141 @@
"children": [
{
"id": 2,
"name": "run",
"kind": 64,
"kindString": "Function",
"name": "RectDocgenTypescriptOptions",
"kind": 4194304,
"kindString": "Type alias",
"flags": {
"isExported": true,
"isConst": true
"isExported": true
},
"comment": {
"shortText": "run API to generate react-docgen-typescript props information tables.",
"returns": "a callable function of type PropsInfoExtractorFunction\n"
"shortText": "a callback to transfor them props table and the options to be passd to react-docgen-typescript."
},
"signatures": [
"sources": [
{
"id": 3,
"name": "run",
"kind": 4096,
"kindString": "Call signature",
"flags": {
"isExported": true
},
"comment": {
"shortText": "run API to generate react-docgen-typescript props information tables.",
"returns": "a callable function of type PropsInfoExtractorFunction\n"
},
"parameters": [
{
"id": 4,
"name": "options",
"kind": 32768,
"kindString": "Parameter",
"fileName": "test.ts",
"line": 6,
"character": 39
}
],
"type": {
"type": "intersection",
"types": [
{
"type": "reflection",
"declaration": {
"id": 3,
"name": "__type",
"kind": 65536,
"kindString": "Type literal",
"flags": {
"isExported": true,
"isOptional": true
"isExported": true
},
"comment": {
"shortText": "configuration options"
},
"type": {
"type": "union",
"types": [
{
"type": "intrinsic",
"name": "undefined"
"children": [
{
"id": 4,
"name": "transformProps",
"kind": 32,
"kindString": "Variable",
"flags": {
"isExported": true,
"isOptional": true
},
"comment": {
"shortText": "callback to transform the props table"
},
{
"type": "intrinsic",
"name": "string"
"sources": [
{
"fileName": "test.ts",
"line": 10,
"character": 16
}
],
"type": {
"type": "union",
"types": [
{
"type": "intrinsic",
"name": "undefined"
},
{
"type": "reflection",
"declaration": {
"id": 5,
"name": "__type",
"kind": 65536,
"kindString": "Type literal",
"flags": {
"isExported": true
},
"signatures": [
{
"id": 6,
"name": "__call",
"kind": 4096,
"kindString": "Call signature",
"flags": {
"isExported": true
},
"parameters": [
{
"id": 7,
"name": "props",
"kind": 32768,
"kindString": "Parameter",
"flags": {
"isExported": true
},
"type": {
"type": "array",
"elementType": {
"type": "reference",
"name": "ComponentDoc"
}
}
}
],
"type": {
"type": "reference",
"name": "ComponentDoc"
}
}
]
}
}
]
}
]
}
}
],
"groups": [
{
"title": "Variables",
"kind": 32,
"children": [
4
]
}
],
"sources": [
{
"fileName": "test.ts",
"line": 6,
"character": 41
}
]
}
],
"type": {
"type": "intrinsic",
"name": "number"
},
{
"type": "reference",
"name": "ParserOptions"
}
}
],
"sources": [
{
"fileName": "test.ts",
"line": 6,
"character": 16
}
]
]
}
}
],
"groups": [
{
"title": "Functions",
"kind": 64,
"title": "Type aliases",
"kind": 4194304,
"children": [
2
]
Expand Down
30 changes: 15 additions & 15 deletions props-info/react-docgen-typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,23 @@ _defined in [@component-controls/react-docgen-typescript-info/src/index.ts](http

### parameters

| Name | Type | Description |
| --------- | ----------------------------------------------------------- | --------------------- |
| `options` | [RectDocgenTypescriptOptions](#rectdocgentypescriptoptions) | configuration options |
| Name | Type | Description |
| --------- | ----------------------------------------------------------- | ------------------------------------------------------- |
| `options` | [RectDocgenTypescriptOptions](#rectdocgentypescriptoptions) | configuration options |
| `returns` | [PropsInfoExtractorFunction](#propsinfoextractorfunction) | a callable function of type PropsInfoExtractorFunction |

## RectDocgenTypescriptOptions

a callback to transfor them props table and the options to be passd to react-docgen-typescript.

_defined in [@component-controls/react-docgen-typescript-info/src/types.ts](https://github.com/ccontrols/component-controls/tree/master/props-info/react-docgen-typescript/src/types.ts#L6)_

**properties:**

callback to transform the props table

**transformProps**: undefined | (`props`\*: [ComponentDoc](#componentdoc)\[]): [ComponentDoc](#componentdoc);

[ParserOptions](#parseroptions)
### properties

--
| Name | Type | Description |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------- |
| `transformProps` | undefined \| (`props`\*: [ComponentDoc](#componentdoc)\[]): [ComponentDoc](#componentdoc); | callback to transform the props table |
| `ParserOptions` | [ParserOptions](#parseroptions) | |

## ComponentDoc

Expand Down Expand Up @@ -130,10 +128,11 @@ _defined in [react-docgen-typescript/lib/parser.d.ts](https://github.com/stylegu

### parameters

| Name | Type | Description |
| --------- | ------------------------- | ----------- |
| `exp*` | [Symbol](#symbol) | |
| `source*` | [SourceFile](#sourcefile) | |
| Name | Type | Description |
| --------- | ------------------------------------ | ----------- |
| `exp*` | [Symbol](#symbol) | |
| `source*` | [SourceFile](#sourcefile) | |
| `returns` | string \| undefined \| null \| false | |

## StaticPropFilter

Expand All @@ -160,6 +159,7 @@ _defined in [react-docgen-typescript/lib/parser.d.ts](https://github.com/stylegu
| ------------ | ----------------------- | ----------- |
| `props*` | [PropItem](#propitem) | |
| `component*` | [Component](#component) | |
| `returns` | boolean | |

## MethodParameter

Expand Down
Loading

0 comments on commit 6c99842

Please sign in to comment.