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

Commit d6f5b46

Browse files
committed
feat: Added support for ref attributes
1 parent f7076e6 commit d6f5b46

File tree

4 files changed

+4
-1
lines changed

4 files changed

+4
-1
lines changed

Diff for: index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ export class Generator {
332332
public props(name: string, props: IPropTypes, fn?: () => void): void {
333333
this.interface(`${name}Props`, () => {
334334
this.prop('key', 'any', true);
335+
this.prop('ref', 'any', true);
335336
Object.keys(props).forEach((propName: any) => {
336337
const prop: IProp = props[propName];
337338
this.prop(propName, prop.type, prop.optional, prop.documentation);

Diff for: tests/es6-class.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ declare module 'component' {
44

55
export interface ComponentProps {
66
key?: any;
7+
ref?: any;
78
/**
89
* This is a jsdoc comment for optionalAny.
910
*/

Diff for: tests/es7-class.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ declare module 'component' {
44

55
export interface ComponentProps {
66
key?: any;
7+
ref?: any;
78
/**
89
* This is a jsdoc comment for optionalAny.
910
*/

Diff for: tests/generator-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('The Generator', () => {
2626
});
2727
it('should write a property interface', () => {
2828
generator.props('Name', {prop: {type: 'type', optional: true}});
29-
assert.equal(generator.toString(), 'export interface NameProps {\n\tkey?: any;\n\tprop?: type;\n}\n');
29+
assert.equal(generator.toString(), 'export interface NameProps {\n\tkey?: any;\n\tref?: any;\n\tprop?: type;\n}\n');
3030
});
3131
it('should write a class with props declaration', () => {
3232
generator.class('Name', true);

0 commit comments

Comments
 (0)