Skip to content

Commit

Permalink
chore: deps, bump expect-type
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Mar 28, 2024
1 parent 5f8d36b commit 38d6ffe
Show file tree
Hide file tree
Showing 4 changed files with 278 additions and 268 deletions.
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
"vitepress": "^1.0.0",
"vue": "^3.2.45"
},
"resolutions": {
"expect-type": "0.15.0"
},
"files": [
"dist",
"dist-esm",
Expand Down
8 changes: 4 additions & 4 deletions src/enum.util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ test('_numberEnumKeys', () => {

test('_numberEnumValues', () => {
expect(_numberEnumValues(MyNumberEnum)).toEqual([1, 2, 3])
expectTypeOf(_numberEnumValues(MyNumberEnum)).toEqualTypeOf<MyNumberEnum[]>()
expectTypeOf(_numberEnumValues(MyNumberEnum)).toEqualTypeOf<number[]>()
expectTypeOf(_numberEnumValues(MyNumberEnum)).toMatchTypeOf<MyNumberEnum[]>()
expectTypeOf(_numberEnumValues(MyNumberEnum)).toMatchTypeOf<number[]>()
const values = _numberEnumValues(MyNumberEnum)
expect(values).toContain(MyNumberEnum.K1)
})
Expand All @@ -78,7 +78,7 @@ test('_stringEnumValues', () => {
]
`)

expectTypeOf(_stringEnumValues(MyStringEnum)).toEqualTypeOf<MyStringEnum[]>()
expectTypeOf(_stringEnumValues(MyStringEnum)).toMatchTypeOf<MyStringEnum[]>()
})

test('_numberEnumEntries', () => {
Expand All @@ -89,7 +89,7 @@ test('_numberEnumEntries', () => {
"K3": 3,
}
`)
expectTypeOf(_numberEnumEntries(MyNumberEnum)).toEqualTypeOf<
expectTypeOf(_numberEnumEntries(MyNumberEnum)).toMatchTypeOf<
[keyof typeof MyNumberEnum, MyNumberEnum][]
>()

Expand Down
19 changes: 13 additions & 6 deletions src/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,20 @@ test('saved/unsaved', () => {
a: number
}>()

expectTypeOf<Item>().toEqualTypeOf<{
a?: number
id: string
created: number
updated: number
}>()

const item = {} as Unsaved<Item>
delete item.a
delete item.id
delete item.created
delete item.updated

expectTypeOf(item).toEqualTypeOf<{
expectTypeOf(item).toMatchTypeOf<{
a?: number
id?: string
created?: number
Expand All @@ -74,7 +81,7 @@ test('saved/unsaved', () => {
}>()

const savedItemDBM = itemDBM as Saved<ItemDBM>
expectTypeOf(savedItemDBM).toEqualTypeOf<{
expectTypeOf(savedItemDBM).toMatchTypeOf<{
id: string
created: number
updated: number
Expand All @@ -87,11 +94,11 @@ test('saved/unsaved', () => {
delete unsavedItem.updated
delete unsavedItem.a

expectTypeOf(unsavedItem).toEqualTypeOf<{
a?: number
expectTypeOf(unsavedItem).toMatchTypeOf<{
id?: string
created?: number
updated?: number
a?: number
}>()

const unsavedItemDBM: Unsaved<ItemDBM> = {
Expand All @@ -103,7 +110,7 @@ test('saved/unsaved', () => {
delete unsavedItemDBM.updated
delete unsavedItemDBM.a

expectTypeOf(unsavedItemDBM).toEqualTypeOf<{
expectTypeOf(unsavedItemDBM).toMatchTypeOf<{
a?: number
id?: string
created?: number
Expand All @@ -113,7 +120,7 @@ test('saved/unsaved', () => {
const unsavedItemId: UnsavedId<ItemDBM> = itemDBM
delete unsavedItemId.id

expectTypeOf(unsavedItemId).toEqualTypeOf<{
expectTypeOf(unsavedItemId).toMatchTypeOf<{
id?: string
created: number
updated: number
Expand Down
Loading

0 comments on commit 38d6ffe

Please sign in to comment.