Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 6fe039e

Browse files
authored
refactor: deprecate generator and use dts-dom library instead (#199)
* update dts-dom to 0.1.11 * test: add test for deprecated generator make sure it does not break
1 parent b6a25f6 commit 6fe039e

File tree

10 files changed

+377
-157
lines changed

10 files changed

+377
-157
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# react-to-typescript-definitions
22

3-
[![GitHub license](https://img.shields.io/github/license/KnisterPeter/react-to-typescript-definitions.svg)]()
3+
[![GitHub license](https://img.shields.io/github/license/KnisterPeter/react-to-typescript-definitions.svg)](https://github.com/KnisterPeter/react-to-typescript-definitions)
44
[![Travis](https://img.shields.io/travis/KnisterPeter/react-to-typescript-definitions.svg)](https://travis-ci.org/KnisterPeter/react-to-typescript-definitions)
55
[![Coveralls branch](https://img.shields.io/coveralls/KnisterPeter/react-to-typescript-definitions/master.svg)](https://coveralls.io/github/KnisterPeter/react-to-typescript-definitions)
66
[![David](https://img.shields.io/david/KnisterPeter/react-to-typescript-definitions.svg)](https://david-dm.org/KnisterPeter/react-to-typescript-definitions)
@@ -11,30 +11,32 @@
1111

1212
Create typescript definitions files (d.ts) from react components.
1313

14-
# Features
14+
## Features
1515

1616
* ES6 and ES7 class syntax
1717
* Most PropTypes
18-
* any, array, bool, func, number, object, string, node, element, oneOfType, arrayOf
18+
* any, array, bool, func, number, object, string, node, element, oneOfType, arrayOf
1919
* required PropTypes
2020
* instanceOf PropTypes (when using API and giving a resolve function)
2121
* jsdoc
2222

23-
# Usage
23+
## Usage
24+
25+
### Installation
2426

25-
## Installation
2627
Install as npm package:
2728

2829
```sh
2930
npm install react-to-typescript-definitions --save-dev
3031
```
32+
3133
or
34+
3235
```sh
3336
npm install -g react-to-typescript-definitions
3437
```
3538

36-
37-
## CLI
39+
### CLI
3840

3941
```sh
4042
# Create a definition which exports a module named 'module-name'
@@ -44,13 +46,14 @@ cat <some/react/component.jsx> |react2dts --name module-name
4446
cat <some/react/component.jsx> |react2dts --top-level-module
4547
```
4648

47-
## API
49+
### API
4850

4951
Functions:
52+
5053
```js
5154
/**
5255
* Returns the typescript definition for the given file.
53-
*
56+
*
5457
* @param name The name of the generated module
5558
* @param path The path to the file to parse
5659
* @param options The options to use
@@ -62,7 +65,7 @@ function generateFromFile(name, path, options)
6265
```js
6366
/**
6467
* Returns the typescript definition for the given source.
65-
*
68+
*
6669
* @param name The name of the generated module
6770
* @param code The code to parse
6871
* @param options The options to use
@@ -74,20 +77,17 @@ function generateFromSource(name, code, options)
7477
```js
7578
/**
7679
* Returns the typescript definition for the given babylon AST object.
77-
*
80+
*
7881
* @param name The name of the generated module
7982
* @param ast The babylon ASt to parse
8083
* @param options The options to use
8184
* @return The type definition as string
8285
*/
8386
function generateFromAst(name, ast, options)
84-
```
87+
```
8588

8689
Options:
87-
* generator
88-
An instance of the exported Generator class. This options is usefull to write
89-
multiple declarations into one .d.ts file. The generator could be used
90-
for consecutive function calls.
90+
9191
* instanceOfResolver
9292
A function which gets a type name (as string) and should return the path
9393
to the file defining the type or undefined if the type is not resolvable.

0 commit comments

Comments
 (0)