pull/2876/head
Richard Harris 6 years ago
parent 5e3ee4e26b
commit 0891495647

@ -394,12 +394,12 @@ export default function dom(
return $name; return $name;
}); });
let unknownPropsCheck; let unknown_props_check;
if (component.compile_options.dev && writable_props.length) { if (component.compile_options.dev && writable_props.length) {
unknownPropsCheck = deindent` unknown_props_check = deindent`
const writableProps = [${writable_props.map(prop => `'${prop.export_name}'`).join(', ')}]; const writable_props = [${writable_props.map(prop => `'${prop.export_name}'`).join(', ')}];
Object.keys($$props).forEach(key => { Object.keys($$props).forEach(key => {
if (!writableProps.includes(key)) console.warn(\`<${component.tag}> was created with unknown attribute '\${key}'\`); if (!writable_props.includes(key)) console.warn(\`<${component.tag}> was created with unknown prop '\${key}'\`);
}); });
`; `;
} }
@ -413,8 +413,8 @@ export default function dom(
${resubscribable_reactive_store_unsubscribers} ${resubscribable_reactive_store_unsubscribers}
${component.javascript} ${component.javascript}
${unknownPropsCheck} ${unknown_props_check}
${component.slots.size && `let { $$slots = {}, $$scope } = $$props;`} ${component.slots.size && `let { $$slots = {}, $$scope } = $$props;`}

@ -66,4 +66,4 @@ class Component extends SvelteComponent {
} }
} }
export default Component; export default Component;

@ -65,9 +65,9 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {
let { name } = $$props; let { name } = $$props;
const writableProps = ['name']; const writable_props = ['name'];
Object.keys($$props).forEach(key => { Object.keys($$props).forEach(key => {
if (!writableProps.includes(key)) console.warn(`<Component> was created with unknown attribute '${key}'`); if (!writable_props.includes(key)) console.warn(`<Component> was created with unknown prop '${key}'`);
}); });
$$self.$set = $$props => { $$self.$set = $$props => {
@ -98,4 +98,4 @@ class Component extends SvelteComponentDev {
} }
} }
export default Component; export default Component;

@ -151,9 +151,9 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {
let { things, foo, bar, baz } = $$props; let { things, foo, bar, baz } = $$props;
const writableProps = ['things', 'foo', 'bar', 'baz']; const writable_props = ['things', 'foo', 'bar', 'baz'];
Object.keys($$props).forEach(key => { Object.keys($$props).forEach(key => {
if (!writableProps.includes(key)) console.warn(`<Component> was created with unknown attribute '${key}'`); if (!writable_props.includes(key)) console.warn(`<Component> was created with unknown prop '${key}'`);
}); });
$$self.$set = $$props => { $$self.$set = $$props => {
@ -220,4 +220,4 @@ class Component extends SvelteComponentDev {
} }
} }
export default Component; export default Component;

@ -151,9 +151,9 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {
let { things, foo } = $$props; let { things, foo } = $$props;
const writableProps = ['things', 'foo']; const writable_props = ['things', 'foo'];
Object.keys($$props).forEach(key => { Object.keys($$props).forEach(key => {
if (!writableProps.includes(key)) console.warn(`<Component> was created with unknown attribute '${key}'`); if (!writable_props.includes(key)) console.warn(`<Component> was created with unknown prop '${key}'`);
}); });
$$self.$set = $$props => { $$self.$set = $$props => {
@ -196,4 +196,4 @@ class Component extends SvelteComponentDev {
} }
} }
export default Component; export default Component;

@ -65,9 +65,9 @@ function instance($$self, $$props, $$invalidate) {
let bar; let bar;
const writableProps = ['foo']; const writable_props = ['foo'];
Object.keys($$props).forEach(key => { Object.keys($$props).forEach(key => {
if (!writableProps.includes(key)) console.warn(`<Component> was created with unknown attribute '${key}'`); if (!writable_props.includes(key)) console.warn(`<Component> was created with unknown prop '${key}'`);
}); });
$$self.$set = $$props => { $$self.$set = $$props => {
@ -102,4 +102,4 @@ class Component extends SvelteComponentDev {
} }
} }
export default Component; export default Component;

@ -4,6 +4,6 @@ export default {
}, },
warnings: [ warnings: [
`<Foo> was created with unknown attribute 'fo'` `<Foo> was created with unknown prop 'fo'`
] ]
}; };

Loading…
Cancel
Save