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

Commit feaba08

Browse files
committed
feat(Updates to typescript 1.8):
1 parent 9786671 commit feaba08

File tree

10 files changed

+13
-23
lines changed

10 files changed

+13
-23
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/index.js
2+
/index.d.ts
23
/node_modules
34
*.js.map
45
/tests/*-test.js

index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as fs from 'fs';
22
import * as babylon from 'babylon';
33

4-
type InstanceOfResolver = (name: string) => string;
4+
export type InstanceOfResolver = (name: string) => string;
55

66
export interface IOptions {
77
/**
@@ -16,7 +16,7 @@ export interface IOptions {
1616
generator?: Generator;
1717
}
1818

19-
interface IASTNode {
19+
export interface IASTNode {
2020
type: string;
2121
loc: Object;
2222
[name: string]: any;
@@ -105,7 +105,7 @@ export function generateFromAst(name: string, ast: any, options: IOptions = {}):
105105
return generator.toString();
106106
}
107107

108-
enum ExportType {
108+
export enum ExportType {
109109
default,
110110
named
111111
}
@@ -331,8 +331,6 @@ export class Generator {
331331

332332
public props(name: string, props: IPropTypes, fn?: () => void): void {
333333
this.interface(`${name}Props`, () => {
334-
this.prop('key', 'any', true);
335-
this.prop('ref', 'any', true);
336334
Object.keys(props).forEach((propName: any) => {
337335
const prop: IProp = props[propName];
338336
this.prop(propName, prop.type, prop.optional, prop.documentation);

tests/es6-class.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ declare module 'component' {
33
import Message from './path/to/Message';
44

55
export interface ComponentProps {
6-
key?: any;
7-
ref?: any;
86
/**
97
* This is a jsdoc comment for optionalAny.
108
*/

tests/es7-class.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ declare module 'component' {
33
import Message from './path/to/Message';
44

55
export interface ComponentProps {
6-
key?: any;
7-
ref?: any;
86
/**
97
* This is a jsdoc comment for optionalAny.
108
*/

tests/generator-test.d.ts

Whitespace-only changes.

tests/generator-test.ts

Lines changed: 1 addition & 1 deletion
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\tref?: any;\n\tprop?: type;\n}\n');
29+
assert.equal(generator.toString(), 'export interface NameProps {\n\tprop?: type;\n}\n');
3030
});
3131
it('should write a class with props declaration', () => {
3232
generator.class('Name', true);

tests/parse-prop-types-test.d.ts

Whitespace-only changes.

tests/parsing-test.d.ts

Whitespace-only changes.

tsconfig.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
"compilerOptions": {
33
"target": "es5",
44
"module": "commonjs",
5-
"noImplicitAny": true
5+
"noImplicitAny": true,
6+
"declaration": true,
7+
"listFiles": true,
8+
"pretty": true
69
},
7-
"files": [
8-
"typings/tsd.d.ts",
9-
"index.ts",
10-
"tests/parsing-test.ts",
11-
"tests/parse-prop-types-test.ts",
12-
"tests/generator-test.ts"
10+
"exclude": [
11+
"node_modules",
12+
"tests/es6-class.d.ts",
13+
"tests/es7-class.d.ts"
1314
]
1415
}

typings/tsd.d.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)