Skip to content

Commit cf34d7d

Browse files
committed
Merge branch 'main' into allow-all-elements
2 parents 742d4a7 + 724cc22 commit cf34d7d

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

.github/workflows/release.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ jobs:
1212
if: ${{ !contains(github.head_ref, 'all-contributors') }}
1313
strategy:
1414
matrix:
15-
node: [10.x, 12.x]
15+
node: [10, 12, 14, 16]
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: 🛑 Cancel Previous Runs
19-
uses: styfle/[email protected].0
19+
uses: styfle/[email protected].1
2020

2121
- name: ⬇️ Checkout repo
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v3
2323

2424
- name: ⎔ Setup node
25-
uses: actions/setup-node@v2
25+
uses: actions/setup-node@v3
2626
with:
2727
node-version: ${{ matrix.node }}
2828

@@ -35,7 +35,7 @@ jobs:
3535
run: npm run validate
3636

3737
- name: ⬆️ Upload coverage report
38-
uses: codecov/codecov-action@v1
38+
uses: codecov/codecov-action@v2
3939

4040
release:
4141
needs: main
@@ -46,15 +46,15 @@ jobs:
4646
github.ref) && github.event_name == 'push' }}
4747
steps:
4848
- name: 🛑 Cancel Previous Runs
49-
uses: styfle/[email protected].0
49+
uses: styfle/[email protected].1
5050

5151
- name: ⬇️ Checkout repo
52-
uses: actions/checkout@v2
52+
uses: actions/checkout@v3
5353

5454
- name: ⎔ Setup node
55-
uses: actions/setup-node@v2
55+
uses: actions/setup-node@v3
5656
with:
57-
node-version: 14
57+
node-version: 16
5858

5959
- name: 📥 Download deps
6060
uses: bahmutov/npm-install@v1

types/index.d.ts

+22-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33
// Definitions by: Rahim Alwer <https://github.com/mihar-22>
44

55
import {queries, Queries, BoundFunction, EventType} from '@testing-library/dom'
6-
import { SvelteComponent } from 'svelte/types/runtime'
6+
import { SvelteComponentTyped } from 'svelte/types/runtime'
77

88
export * from '@testing-library/dom'
99

10-
type SvelteComponentOptions = any
10+
export interface SvelteComponentOptions<P extends Record<string, any> = any> {
11+
target?: HTMLElement
12+
anchor?: string
13+
props?: P
14+
context?: any
15+
hydrate?: boolean
16+
intro?: boolean
17+
}
1118

1219
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
1320

@@ -16,7 +23,7 @@ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
1623
*/
1724
export type RenderResult<Q extends Queries = typeof queries> = {
1825
container: Element
19-
component: SvelteComponent
26+
component: SvelteComponentTyped
2027
debug: (el?: Element | DocumentFragment) => void
2128
rerender: (options: SvelteComponentOptions) => void
2229
unmount: () => void
@@ -28,17 +35,27 @@ export interface RenderOptions<Q extends Queries = typeof queries> {
2835
}
2936

3037
export function render(
31-
component: typeof SvelteComponent,
38+
component: SvelteComponentTyped,
3239
componentOptions?: SvelteComponentOptions,
3340
renderOptions?: Omit<RenderOptions, 'queries'>
3441
): RenderResult
3542

3643
export function render<Q extends Queries>(
37-
component: typeof SvelteComponent,
44+
component: SvelteComponentTyped,
3845
componentOptions?: SvelteComponentOptions,
3946
renderOptions?: RenderOptions<Q>,
4047
): RenderResult<Q>
4148

49+
export function render<
50+
P extends Record<string, any> = any,
51+
E extends Record<string, any> = any,
52+
S extends Record<string, any> = any
53+
>(
54+
component: SvelteComponentTyped<P, E, S>,
55+
componentOptions?: SvelteComponentOptions<P>,
56+
renderOptions?: Omit<RenderOptions, "queries">
57+
): RenderResult;
58+
4259
/**
4360
* Unmounts trees that were mounted with render.
4461
*/

0 commit comments

Comments
 (0)