mirror of https://github.com/sveltejs/svelte
parent
c2e05e1939
commit
c5594717ab
@ -1,33 +1,35 @@
|
|||||||
import { createEventDispatcher } from '$runtime/internal/lifecycle';
|
// TODO: enable those tests when #7224 got merged
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{
|
// import { createEventDispatcher } from '$runtime/internal/lifecycle';
|
||||||
loaded: never
|
|
||||||
change: string
|
|
||||||
valid: boolean
|
|
||||||
optional: number | null
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// @ts-expect-error: dispatch invalid event
|
// const dispatch = createEventDispatcher<{
|
||||||
dispatch('some-event');
|
// loaded: never
|
||||||
|
// change: string
|
||||||
|
// valid: boolean
|
||||||
|
// optional: number | null
|
||||||
|
// }>();
|
||||||
|
|
||||||
dispatch('loaded');
|
// // @ts-expect-error: dispatch invalid event
|
||||||
// @ts-expect-error: no detail accepted
|
// dispatch('some-event');
|
||||||
dispatch('loaded', 123);
|
|
||||||
|
|
||||||
// @ts-expect-error: detail not provided
|
// dispatch('loaded');
|
||||||
dispatch('change');
|
// // @ts-expect-error: no detail accepted
|
||||||
dispatch('change', 'string');
|
// dispatch('loaded', 123);
|
||||||
// @ts-expect-error: wrong type of detail
|
|
||||||
dispatch('change', 123);
|
|
||||||
// @ts-expect-error: wrong type of detail
|
|
||||||
dispatch('change', undefined);
|
|
||||||
|
|
||||||
dispatch('valid', true);
|
// // @ts-expect-error: detail not provided
|
||||||
// @ts-expect-error: wrong type of detail
|
// dispatch('change');
|
||||||
dispatch('valid', 'string');
|
// dispatch('change', 'string');
|
||||||
|
// // @ts-expect-error: wrong type of detail
|
||||||
|
// dispatch('change', 123);
|
||||||
|
// // @ts-expect-error: wrong type of detail
|
||||||
|
// dispatch('change', undefined);
|
||||||
|
|
||||||
dispatch('optional');
|
// dispatch('valid', true);
|
||||||
dispatch('optional', 123);
|
// // @ts-expect-error: wrong type of detail
|
||||||
dispatch('optional', null);
|
// dispatch('valid', 'string');
|
||||||
// @ts-expect-error: wrong type of optional detail
|
|
||||||
dispatch('optional', 'string');
|
// dispatch('optional');
|
||||||
|
// dispatch('optional', 123);
|
||||||
|
// dispatch('optional', null);
|
||||||
|
// // @ts-expect-error: wrong type of optional detail
|
||||||
|
// dispatch('optional', 'string');
|
||||||
|
|||||||
Loading…
Reference in new issue