Skip to content

Commit

Permalink
fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
matthyk committed Feb 8, 2024
1 parent ea8799c commit bfee167
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export interface OverviewStructure<T = {}, D extends Record<PropertyKey, unknown
source?: OverviewStructureSource,
children?: OverviewStructure<T>[],
decorators?: {
decorate: (Omit<OverviewStructureDecorator, keyof ExtractDecoratorType<D, 'instance'>> & ExtractDecoratorType<D, 'instance'> )[],
decorateRequest: (Omit<OverviewStructureDecorator, keyof ExtractDecoratorType<D, 'request'>> & ExtractDecoratorType<D, 'request'> )[],
decorateReply: (Omit<OverviewStructureDecorator, keyof ExtractDecoratorType<D, 'reply'>> & ExtractDecoratorType<D, 'reply'> )[]
decorate: (Omit<OverviewStructureDecorator, keyof ExtractDecoratorType<D, 'instance'>> & ExtractDecoratorType<D, 'instance'>)[],
decorateRequest: (Omit<OverviewStructureDecorator, keyof ExtractDecoratorType<D, 'request'>> & ExtractDecoratorType<D, 'request'>)[],
decorateReply: (Omit<OverviewStructureDecorator, keyof ExtractDecoratorType<D, 'reply'>> & ExtractDecoratorType<D, 'reply'>)[]
},
hooks?: OverviewStructureHooks,
routes?: (Omit<RouteItem, keyof T> & T)[]
Expand Down
12 changes: 6 additions & 6 deletions test/types/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ app
} else {
return {}
}
}
}
})
.after((_) => {
const data = app.overview<{}, { embedded: string[] }>()

expectType<OverviewStructure<{},{ embedded: string[] }>>(data)
expectType<OverviewStructure<{}, { embedded: string[] }>>(data)
expectAssignable<{ type: string, name: string, embedded: string[] }>(data.decorators!.decorate[0]!)
expectAssignable<{ type: string, name: string, embedded: string[] }>(data.decorators!.decorateRequest[0]!)
expectAssignable<{ type: string, name: string, embedded: string[] }>(data.decorators!.decorateReply[0]!)
Expand All @@ -75,17 +75,17 @@ app
.register(fastifyOverview, {
onDecorateDefinition: (type, name, value) => {
if (type === 'decorate') {
if (typeof value === 'object' && !Array.isArray( value )) {
if (typeof value === 'object' && !Array.isArray(value)) {
return {
embedded: Object.keys( value ?? {} )
embedded: Object.keys(value ?? {})
}
} else {
return {}
}
} else if (type === 'decorateRequest') {
if (typeof value === 'object' && !Array.isArray( value )) {
if (typeof value === 'object' && !Array.isArray(value)) {
return {
recursiveNum: Object.keys( value ?? {} ).length
recursiveNum: Object.keys(value ?? {}).length
}
} else {
return {}
Expand Down

0 comments on commit bfee167

Please sign in to comment.