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

Commit a54511e

Browse files
committed
feat: Added react key to generated props
1 parent 8901581 commit a54511e

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

Diff for: cli.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var react2dts = require('./index');
33
var minimist = require('minimist');
44

55
var options = minimist(process.argv.slice(2), {
6-
string: 'name'
6+
string: ['name']
77
});
88

99
react2dts.cli(options);

Diff for: index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ class Writer {
188188

189189
public props(name: string, props: any, fn?: () => void): void {
190190
this.interface(`${name}Props`, () => {
191+
this.prop('key', 'any', true);
191192
Object.keys(props).forEach((propName: any) => this.prop(propName, props[propName], true));
192193
});
193194
if (fn) {

Diff for: tests/simple-component.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ declare module 'simple-component' {
22
import * as React from 'react';
33

44
interface SimpleComponentProps {
5+
key?: any;
56
optionalAny?: any;
67
optionalArray?: any[];
78
optionalBool?: boolean;

0 commit comments

Comments
 (0)