@@ -5,9 +5,11 @@ import path from "path";
55import { program } from "@commander-js/extra-typings" ;
66import { typeScriptToPython } from "./typeScriptToPython" ;
77import { Ts2PyConfig } from "./config" ;
8- import { readFileSync } from "fs" ;
98
10- const compile = ( fileNames : string [ ] , config : Ts2PyConfig & { strict ?: boolean } ) => {
9+ const compile = (
10+ fileNames : string [ ] ,
11+ config : Ts2PyConfig & { strict ?: boolean } ,
12+ ) => {
1113 const program = ts . createProgram ( fileNames , {
1214 noEmit : true ,
1315 allowJs : true ,
@@ -23,18 +25,24 @@ const compile = (fileNames: string[], config: Ts2PyConfig & {strict?: boolean})
2325 . map ( ( fn ) => path . relative ( fn , f . fileName ) === "" )
2426 . reduce ( ( a , b ) => a || b ) ,
2527 ) ;
26- const transpiled = typeScriptToPython ( program . getTypeChecker ( ) , relevantSourceFiles , config )
28+ const transpiled = typeScriptToPython (
29+ program . getTypeChecker ( ) ,
30+ relevantSourceFiles ,
31+ config ,
32+ ) ;
2733 console . log ( transpiled ) ;
28- }
34+ } ;
2935
3036program
3137 . name ( "typescript2python" )
3238 . description ( "A program that converts TypeScript type definitions to Python" )
33- . option ( "--nullable-optionals" , "if set, optional entries in dictionaries will be nullable, e.g. `NotRequired[Optional[T]]`" )
39+ . option (
40+ "--nullable-optionals" ,
41+ "if set, optional entries in dictionaries will be nullable, e.g. `NotRequired[Optional[T]]`" ,
42+ )
3443 . option ( "--strict" , "Enable all strict type-checking options." )
3544 . arguments ( "<input...>" )
3645 . action ( ( args , options ) => {
37- compile ( args , options )
46+ compile ( args , options ) ;
3847 } )
39- . parse ( process . argv )
40-
48+ . parse ( process . argv ) ;
0 commit comments