Skip to content

Commit

Permalink
Fix SerializerCompiler type
Browse files Browse the repository at this point in the history
  • Loading branch information
remidewitte committed Apr 3, 2024
1 parent 6e8d53a commit e0d3232
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 1 addition & 4 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ declare namespace SerializerSelector {
options?: Options
) => SerializerCompiler;

export type SerializerCompiler = (
externalSchemas?: unknown,
options?: Options
) => Serializer;
export type SerializerCompiler = (routeDef: RouteDefinition) => Serializer;

export type Serializer = (doc: any) => string

Expand Down
5 changes: 4 additions & 1 deletion types/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import SerializerSelector, {
expectType<SerializerFactory>(factory);
const compiler = factory(externalSchemas1, {})
expectType<SerializerCompiler>(compiler);
const serializeFunc = compiler({ schema: sampleSchema })
const serializeFunc = compiler({ schema: sampleSchema, method: '', url:'', httpStatus: '' })
expectType<Serializer>(serializeFunc);

expectType<string>(serializeFunc({ name: 'hello' }))
Expand Down Expand Up @@ -88,6 +88,9 @@ expectType<SerializerFactory>(writer);
}

const endpointSchema = {
method: '',
url: '',
httpStatus: '',
schema: {
$id: 'urn:schema:endpoint',
$ref: 'urn:schema:ref'
Expand Down

0 comments on commit e0d3232

Please sign in to comment.