@@ -19,7 +19,7 @@ const prettierOptions: prettier.Options = {
1919
2020const formatDocs = ( content : string ) => prettier . format ( content , prettierOptions ) ;
2121
22- test ( '完整的类型提示 ' , async ( ) => {
22+ test ( '完整的文件内容 ' , async ( ) => {
2323 const docs = getBasicDocument ( {
2424 '/users' : {
2525 get : {
@@ -456,14 +456,26 @@ describe('类', () => {
456456 responseTypes : [ ] ,
457457 tags : [ ] ,
458458 } ,
459+ {
460+ uri : '/c' ,
461+ method : 'get' ,
462+ key : 'cc' ,
463+ query : { optional : true , types : [ ] } ,
464+ params : { optional : true , types : [ ] } ,
465+ body : { optional : true , types : [ ] } ,
466+ response : { types : [ ] } ,
467+ contentTypes : [ ] ,
468+ responseTypes : [ ] ,
469+ tags : [ ] ,
470+ } ,
459471 ] ,
460472 } ) ;
461473 const content = generateMethodModeClass ( 'Client' , metas ) ;
462474 await expect ( formatDocs ( content ) ) . resolves . toMatchInlineSnapshot ( `
463475 "export class Client<T extends object = object> extends BaseOpenapiClient<T> {
464476 get<K extends keyof Client_get_paths>(
465477 uri: K,
466- ...rest: K extends '/b'
478+ ...rest: K extends '/b' | '/c'
467479 ? [opts?: Client_get_paths[K]['request'] & BaseOpenapiClient.UserInputOpts<T>]
468480 : [opts: Client_get_paths[K]['request'] & BaseOpenapiClient.UserInputOpts<T>]
469481 ): Promise<Client_get_paths[K]['response']> {
0 commit comments