1- import { JSONSchema7 } from 'json-schema' ;
1+ import { type JSONSchema7 } from 'json-schema' ;
22import fs from 'node:fs' ;
33import YAML from 'yaml' ;
4- import type OpenApiSpec from '../openapi/index.js' ;
4+ import { type OpenApiSpecification } from '../openapi/index.js' ;
55import { OpenApiMethods } from '../openapi/PathItem.js' ;
6- import operationToFunction , { FunctionMetadata } from './function.js' ;
6+ import operationToFunction , { type FunctionMetadata } from './function.js' ;
77import generateModels from './models.js' ;
88import generateResponses from './responses.js' ;
99import configuration from './utility/configuration.js' ;
1010import { NotImplementedError } from './utility/errors.js' ;
1111import lintAndCheckFiles from './utility/lintAndCheckFiles.js' ;
1212import { default as rootLogger } from './utility/logger.js' ;
13- import PathInfo , { FileInfo , resolveAbsolutePath } from './utility/PathInfo.js' ;
13+ import { type FileInfo , type PathInfo , resolveAbsolutePath } from './utility/PathInfo.js' ;
1414import template from './utility/templater.js' ;
1515import writeSourceFile from './utility/writeSourceFile.js' ;
1616
17+ import baselineTsConfig from '../../tsconfig.json' with { type : 'json' } ;
18+
1719const logger = rootLogger . child ( { context : 'client' } ) ;
1820
1921const processPaths = (
20- paths : Required < OpenApiSpec > [ 'paths' ] ,
22+ paths : Required < OpenApiSpecification > [ 'paths' ] ,
2123 outDir : PathInfo ,
2224) : FunctionMetadata [ ] => {
2325 logger . info ( 'Mkdir' , resolveAbsolutePath ( outDir ) ) ;
@@ -166,17 +168,16 @@ const generatePackage = (version: string, outDir: PathInfo) => {
166168 { ...outDir , path : '.' , filename : 'tsconfig.json' } ,
167169 JSON . stringify (
168170 {
171+ ...baselineTsConfig ,
169172 compilerOptions : {
173+ ...baselineTsConfig . compilerOptions ,
170174 declaration : true ,
171- target : 'es2020' ,
172- module : 'nodenext' ,
173- noImplicitAny : true ,
174175 outDir : 'dist' ,
175176 rootDir : '.' ,
176177 typeRoots : [ 'node_modules/@types' ] ,
177- moduleResolution : 'NodeNext' ,
178- allowSyntheticDefaultImports : true ,
178+ lib : [ ...baselineTsConfig . compilerOptions . lib , 'dom' , 'dom.iterable' ] ,
179179 } ,
180+ include : [ '**/*.ts' ] ,
180181 exclude : [ 'dist' , 'node_modules' ] ,
181182 } ,
182183 null ,
@@ -187,7 +188,7 @@ const generatePackage = (version: string, outDir: PathInfo) => {
187188
188189const client = async ( specPath : string , outPath : PathInfo ) => {
189190 // TODO: validation
190- let spec : OpenApiSpec ;
191+ let spec : OpenApiSpecification ;
191192 if ( [ '.yml' , '.yaml' ] . some ( ( e ) => specPath . endsWith ( e ) ) ) {
192193 const fileContents = fs . readFileSync ( specPath ) . toString ( ) ;
193194 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
0 commit comments