revert duplicate prop name validation (valid use cases exist)

props-bindable
Simon Holthausen 7 months ago
parent a472ccf828
commit efcc5ac6b3

@ -422,7 +422,6 @@ export function analyze_component(root, options) {
options,
ast_type: ast === instance.ast ? 'instance' : ast === template.ast ? 'template' : 'module',
parent_element: null,
all_prop_names: new Set(),
has_props_rune: [false, false],
component_slots: new Set(),
expression: null,
@ -447,7 +446,6 @@ export function analyze_component(root, options) {
analysis,
options,
parent_element: null,
all_prop_names: new Set(),
has_props_rune: [false, false],
ast_type: ast === instance.ast ? 'instance' : ast === template.ast ? 'template' : 'module',
instance_scope: instance.scope,
@ -527,16 +525,6 @@ export function analyze_component(root, options) {
}
}
if (analysis.runes) {
const props = new Set();
for (const [name, binding] of instance.scope.declarations) {
if (binding.kind === 'prop' || binding.kind === 'bindable_prop') {
if (props.has(binding)) {
}
}
}
}
if (analysis.css.ast) {
analyze_css(analysis.css.ast, analysis);

@ -15,8 +15,6 @@ export interface AnalysisState {
options: ValidatedCompileOptions;
ast_type: 'instance' | 'template' | 'module';
parent_element: string | null;
/** Names of $props() and $props.bindable() */
all_prop_names: Set<string>;
has_props_rune: [props: boolean, bindings: boolean];
/** Which slots the current parent component has */
component_slots: Set<string>;

@ -1095,12 +1095,6 @@ export const validation_runes = merge(validation, a11y_validators, {
if (value.type !== 'Identifier' || property.key.type !== 'Identifier') {
error(property, 'invalid-props-pattern');
}
if (state.all_prop_names.has(property.key.name)) {
error(property, 'duplicate-prop-name');
}
state.all_prop_names.add(property.key.name);
} else if (rune === '$props.bindable') {
error(property, 'invalid-props-rest-element');
}

@ -1,5 +1,6 @@
<script>
let { checked, ...rest } = $props.bindable();
let { checked: _, ...rest } = $props();
let { checked } = $props.bindable();
</script>
<input type="checkbox" bind:checked {...rest} />

Loading…
Cancel
Save