Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit 5c955c8

Browse files
committed
test: add custom extensions
1 parent 5b7cfc2 commit 5c955c8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/openapi-types/src/openapi.test-d.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expectTypeOf } from 'vitest'
1+
import { assertType, expectTypeOf } from 'vitest'
22
import { describe, it } from 'vitest'
33

44
import { OpenAPI, OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from './index'
@@ -35,4 +35,13 @@ describe('OpenAPI', () => {
3535

3636
expectTypeOf(specification).toMatchTypeOf<OpenAPIV3_1.Document>()
3737
})
38+
39+
it('types a custom extension', () => {
40+
const specification: OpenAPI.Document<{
41+
'x-custom'?: boolean
42+
}> = {}
43+
44+
expectTypeOf(specification['random-attribute']).toEqualTypeOf<any>()
45+
expectTypeOf(specification['x-custom']).toEqualTypeOf<boolean>()
46+
})
3847
})

0 commit comments

Comments
 (0)