fix: disallow on directive with custom renderers

svelte-custom-renderer
paoloricciuti 2 weeks ago
parent 7c74482796
commit b4431e9738

@ -1,5 +1,6 @@
/** @import { AST } from '#compiler' */
/** @import { Context } from '../types' */
import * as e from '../../../errors.js';
import * as w from '../../../warnings.js';
import { mark_subtree_dynamic } from './shared/fragment.js';
@ -8,6 +9,10 @@ import { mark_subtree_dynamic } from './shared/fragment.js';
* @param {Context} context
*/
export function OnDirective(node, context) {
if (context.state.analysis.custom_renderer) {
e.incompatible_with_custom_renderer(node, '`on:`');
}
if (context.state.analysis.runes) {
const parent_type = context.path.at(-1)?.type;

@ -0,0 +1,5 @@
import { test } from '../../test';
export default test({
compile_error: '`on:` is not compatible with `customRenderer`'
});

@ -0,0 +1 @@
<button on:click={() => {}}>click me</button>
Loading…
Cancel
Save