1- import * as astqts from 'astq' ;
2- const ASTQ : typeof astqts . ASTQ = astqts as any ;
1+ import * as ASTQ from 'astq' ;
32import * as dom from 'dts-dom' ;
43import { InstanceOfResolver } from './index' ;
54import * as types from './types' ;
@@ -69,7 +68,7 @@ export function createTypings(moduleName: string|null, ast: any,
6968 }
7069} ;
7170
72- function createPropTypeTypings ( interf : dom . InterfaceDeclaration , astq : astqts . ASTQ , propTypes : any ,
71+ function createPropTypeTypings ( interf : dom . InterfaceDeclaration , astq : ASTQ , propTypes : any ,
7372 propTypesName : string | undefined ) : void {
7473 const res = astq . query ( propTypes , `
7574 / ObjectProperty
@@ -117,7 +116,7 @@ export function propTypeQueryExpression(propTypesName: string|undefined): string
117116 ` ;
118117}
119118
120- function getReactComponentName ( astq : astqts . ASTQ , ast : any ) : string | undefined {
119+ function getReactComponentName ( astq : ASTQ , ast : any ) : string | undefined {
121120 const res = astq . query ( ast , `
122121 // ImportDeclaration[
123122 /:source StringLiteral[@value == 'react']
@@ -133,7 +132,7 @@ function getReactComponentName(astq: astqts.ASTQ, ast: any): string|undefined {
133132 return undefined ;
134133}
135134
136- function getPropTypesName ( astq : astqts . ASTQ , ast : any ) : string | undefined {
135+ function getPropTypesName ( astq : ASTQ , ast : any ) : string | undefined {
137136 const res = astq . query ( ast , `
138137 // ImportDeclaration[
139138 /:source StringLiteral[@value == 'react']
@@ -149,7 +148,7 @@ function getPropTypesName(astq: astqts.ASTQ, ast: any): string|undefined {
149148 return undefined ;
150149}
151150
152- function hasReactClass ( astq : astqts . ASTQ , ast : any , reactComponentName : string | undefined ) : boolean {
151+ function hasReactClass ( astq : ASTQ , ast : any , reactComponentName : string | undefined ) : boolean {
153152 const res = astq . query ( ast , `
154153 // ClassDeclaration[
155154 '${ reactComponentName } ' == 'undefined'
@@ -179,7 +178,7 @@ function hasReactClass(astq: astqts.ASTQ, ast: any, reactComponentName: string|u
179178 return res . length > 0 ;
180179}
181180
182- function getInstanceOfPropTypes ( astq : astqts . ASTQ , ast : any , propTypesName : string | undefined ) : string [ ] {
181+ function getInstanceOfPropTypes ( astq : ASTQ , ast : any , propTypesName : string | undefined ) : string [ ] {
183182 const res = astq . query ( ast , `
184183 // CallExpression[
185184 /:callee MemberExpression[
@@ -198,7 +197,7 @@ interface ImportStatement {
198197 local : string ;
199198 path : string ;
200199}
201- function getImportStatements ( astq : astqts . ASTQ , ast : any , typeNames : string [ ] ,
200+ function getImportStatements ( astq : ASTQ , ast : any , typeNames : string [ ] ,
202201 instanceOfResolver : InstanceOfResolver | undefined ) : ImportStatement [ ] {
203202 return typeNames . map ( name => {
204203 const res = astq . query ( ast , `
@@ -228,7 +227,7 @@ function getImportStatements(astq: astqts.ASTQ, ast: any, typeNames: string[],
228227 . filter ( importStatement => Boolean ( importStatement . path ) ) ;
229228}
230229
231- function getComponentNamesByPropTypeAssignment ( astq : astqts . ASTQ , ast : any ) : string [ ] {
230+ function getComponentNamesByPropTypeAssignment ( astq : ASTQ , ast : any ) : string [ ] {
232231 const res = astq . query ( ast , `
233232 //AssignmentExpression
234233 /:left MemberExpression[
@@ -242,7 +241,7 @@ function getComponentNamesByPropTypeAssignment(astq: astqts.ASTQ, ast: any): str
242241 return [ ] ;
243242}
244243
245- function getComponentNamesByStaticPropTypeAttribute ( astq : astqts . ASTQ , ast : any ) : string [ ] {
244+ function getComponentNamesByStaticPropTypeAttribute ( astq : ASTQ , ast : any ) : string [ ] {
246245 const res = astq . query ( ast , `
247246 //ClassDeclaration[
248247 /:body * //ClassProperty /:key Identifier[@name == 'propTypes']
@@ -254,7 +253,7 @@ function getComponentNamesByStaticPropTypeAttribute(astq: astqts.ASTQ, ast: any)
254253 return [ ] ;
255254}
256255
257- function getComponentNamesByJsxInBody ( astq : astqts . ASTQ , ast : any ) : string [ ] {
256+ function getComponentNamesByJsxInBody ( astq : ASTQ , ast : any ) : string [ ] {
258257 const res = astq . query ( ast , `
259258 // ClassDeclaration[
260259 /:body * //JSXElement
@@ -273,7 +272,7 @@ function getComponentNamesByJsxInBody(astq: astqts.ASTQ, ast: any): string[] {
273272 return [ ] ;
274273}
275274
276- function getPropTypesFromAssignment ( astq : astqts . ASTQ , ast : any , componentName : string ) : any | undefined {
275+ function getPropTypesFromAssignment ( astq : ASTQ , ast : any , componentName : string ) : any | undefined {
277276 const res = astq . query ( ast , `
278277 //AssignmentExpression[
279278 /:left MemberExpression[
@@ -288,7 +287,7 @@ function getPropTypesFromAssignment(astq: astqts.ASTQ, ast: any, componentName:
288287 return undefined ;
289288}
290289
291- function getPropTypesFromStaticAttribute ( astq : astqts . ASTQ , ast : any , componentName : string ) : any | undefined {
290+ function getPropTypesFromStaticAttribute ( astq : ASTQ , ast : any , componentName : string ) : any | undefined {
292291 const res = astq . query ( ast , `
293292 //ClassDeclaration[
294293 /:id Identifier[@name == '${ componentName } ']
@@ -305,7 +304,7 @@ function getPropTypesFromStaticAttribute(astq: astqts.ASTQ, ast: any, componentN
305304 return undefined ;
306305}
307306
308- function getComponentExportType ( astq : astqts . ASTQ , ast : any , componentName : string ) : dom . DeclarationFlags | undefined {
307+ function getComponentExportType ( astq : ASTQ , ast : any , componentName : string ) : dom . DeclarationFlags | undefined {
309308 let res = astq . query ( ast , `
310309 // ExportDefaultDeclaration[
311310 // ClassDeclaration
@@ -351,7 +350,7 @@ function getComponentExportType(astq: astqts.ASTQ, ast: any, componentName: stri
351350 return undefined ;
352351}
353352
354- function isClassComponent ( astq : astqts . ASTQ , ast : any , componentName : string ,
353+ function isClassComponent ( astq : ASTQ , ast : any , componentName : string ,
355354 reactComponentName : string | undefined ) : boolean {
356355 const res = astq . query ( ast , `
357356 // ClassDeclaration
0 commit comments