Skip to content

Commit b2005b7

Browse files
authored
test: replace deprecated toMatchTypeOf (#434)
1 parent e86dada commit b2005b7

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
"svelte-check": "^3.0.0 || ^4.0.4",
128128
"svelte-jester": "^5.0.0",
129129
"typescript": "^5.5.3",
130+
"typescript-svelte-plugin": "^0.3.46",
130131
"vite": "^4.0.0 || ^5.3.3",
131132
"vitest": "0.x.x || ^1.0.0 || ^2.0.2"
132133
}

src/__tests__/render-runes.test-d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('types', () => {
2929
test('render result has container and component', () => {
3030
const result = subject.render(Component, { name: 'Alice', count: 42 })
3131

32-
expectTypeOf(result).toMatchTypeOf<{
32+
expectTypeOf(result).toExtend<{
3333
container: HTMLElement
3434
component: { hello: string }
3535
debug: (el?: HTMLElement) => void
@@ -55,7 +55,7 @@ describe('legacy component types', () => {
5555
count: 42,
5656
})
5757

58-
expectTypeOf(component).toMatchTypeOf<{ hello: string }>()
58+
expectTypeOf(component).toExtend<{ hello: string }>()
5959

6060
// @ts-expect-error: Svelte 5 mount does not return `$set`
6161
component.$on('greeting', onGreeting)

src/__tests__/render-utilities.test-d.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('render query and utility types', () => {
88
test('render result has default queries', () => {
99
const result = subject.render(Component, { name: 'Alice' })
1010

11-
expectTypeOf(result.getByRole).parameters.toMatchTypeOf<
11+
expectTypeOf(result.getByRole).parameters.toExtend<
1212
[role: subject.ByRoleMatcher, options?: subject.ByRoleOptions]
1313
>()
1414
})
@@ -27,25 +27,25 @@ describe('render query and utility types', () => {
2727
{ queries: { getByVibes } }
2828
)
2929

30-
expectTypeOf(result.getByVibes).parameters.toMatchTypeOf<[vibes: string]>()
30+
expectTypeOf(result.getByVibes).parameters.toExtend<[vibes: string]>()
3131
})
3232

3333
test('act is an async function', () => {
34-
expectTypeOf(subject.act).toMatchTypeOf<() => Promise<void>>()
34+
expectTypeOf(subject.act).toExtend<() => Promise<void>>()
3535
})
3636

3737
test('act accepts a sync function', () => {
38-
expectTypeOf(subject.act).toMatchTypeOf<(fn: () => void) => Promise<void>>()
38+
expectTypeOf(subject.act).toExtend<(fn: () => void) => Promise<void>>()
3939
})
4040

4141
test('act accepts an async function', () => {
42-
expectTypeOf(subject.act).toMatchTypeOf<
42+
expectTypeOf(subject.act).toExtend<
4343
(fn: () => Promise<void>) => Promise<void>
4444
>()
4545
})
4646

4747
test('fireEvent is an async function', () => {
48-
expectTypeOf(subject.fireEvent).toMatchTypeOf<
48+
expectTypeOf(subject.fireEvent).toExtend<
4949
(
5050
element: Element | Node | Document | Window,
5151
event: Event
@@ -54,7 +54,7 @@ describe('render query and utility types', () => {
5454
})
5555

5656
test('fireEvent[eventName] is an async function', () => {
57-
expectTypeOf(subject.fireEvent.click).toMatchTypeOf<
57+
expectTypeOf(subject.fireEvent.click).toExtend<
5858
(
5959
element: Element | Node | Document | Window,
6060
// eslint-disable-next-line @typescript-eslint/no-empty-object-type

src/__tests__/render.test-d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('types', () => {
3737
test('render result has container and component', () => {
3838
const result = subject.render(Component, { name: 'Alice', count: 42 })
3939

40-
expectTypeOf(result).toMatchTypeOf<{
40+
expectTypeOf(result).toExtend<{
4141
container: HTMLElement
4242
component: { hello: string }
4343
debug: (el?: HTMLElement) => void

tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"noEmit": true,
66
"skipLibCheck": true,
77
"strict": true,
8-
"types": ["svelte", "vite/client", "vitest", "vitest/globals"]
8+
"types": ["svelte", "vite/client", "vitest", "vitest/globals"],
9+
"plugins": [{ "name": "typescript-svelte-plugin" }]
910
},
1011
"include": ["src"]
1112
}

0 commit comments

Comments
 (0)