forked from lyft/react-javascript-to-typescript-transform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
50 lines (45 loc) · 1.86 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import * as ts from 'typescript';
import { compile } from './compiler';
import {
reactJSMakePropsAndStateInterfaceTransformFactoryFactory,
} from './transforms/react-js-make-props-and-state-transform';
import {
reactHoistGenericsTransformFactoryFactory,
} from './transforms/react-hoist-generics-transform';
import {
reactRemovePropTypesAssignmentTransformFactoryFactory,
} from './transforms/react-remove-prop-types-assignment-transform';
import {
reactMovePropTypesToClassTransformFactoryFactory,
} from './transforms/react-move-prop-types-to-class-transform';
import {
collapseIntersectionInterfacesTransformFactoryFactory,
} from './transforms/collapse-intersection-interfaces-transform';
import {
reactRemoveStaticPropTypesMemberTransformFactoryFactory,
} from './transforms/react-remove-static-prop-types-member-transform';
export {
reactMovePropTypesToClassTransformFactoryFactory,
reactJSMakePropsAndStateInterfaceTransformFactoryFactory,
reactHoistGenericsTransformFactoryFactory,
collapseIntersectionInterfacesTransformFactoryFactory,
reactRemovePropTypesAssignmentTransformFactoryFactory,
reactRemoveStaticPropTypesMemberTransformFactoryFactory,
compile,
};
export const allTransforms = [
reactMovePropTypesToClassTransformFactoryFactory,
reactJSMakePropsAndStateInterfaceTransformFactoryFactory,
reactHoistGenericsTransformFactoryFactory,
collapseIntersectionInterfacesTransformFactoryFactory,
reactRemovePropTypesAssignmentTransformFactoryFactory,
reactRemoveStaticPropTypesMemberTransformFactoryFactory,
];
export type TransformFactoryFactory = (typeChecker: ts.TypeChecker) => ts.TransformerFactory<ts.SourceFile>;
/**
* Run React JavaScript to TypeScript transform for file at `filePath`
* @param filePath
*/
export function run(filePath: string): string {
return compile(filePath, allTransforms);
}