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

Commit 511767d

Browse files
committed
feat: Exported component interfaces
1 parent 8961ec2 commit 511767d

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Diff for: index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ export class Generator {
368368

369369
public interface(name: string, fn: () => void): void {
370370
this.indent();
371-
this.code += `interface ${name} {`;
371+
this.code += `export interface ${name} {`;
372372
this.nl();
373373
this.indentLevel++;
374374
fn();

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ declare module 'component' {
22
import * as React from 'react';
33
import Message from './path/to/Message';
44

5-
interface ComponentProps {
5+
export interface ComponentProps {
66
key?: any;
77
/**
88
* This is a jsdoc comment for optionalAny.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ declare module 'component' {
22
import * as React from 'react';
33
import Message from './path/to/Message';
44

5-
interface ComponentProps {
5+
export interface ComponentProps {
66
key?: any;
77
/**
88
* This is a jsdoc comment for optionalAny.

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(), 'interface NameProps {\n\tkey?: any;\n\tprop?: type;\n}\n');
29+
assert.equal(generator.toString(), 'export interface NameProps {\n\tkey?: 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)