Use IE-compatible js to check for unknown prop warnings (#3915)

Fixes #3914
pull/3917/head
Conduitry 5 years ago committed by GitHub
parent 8237db4422
commit afe5ad430a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -247,7 +247,7 @@ export default function dom(
function create_fragment(#ctx) {
${block.get_contents()}
}
`);
`);
}
body.push(b`
@ -369,7 +369,7 @@ export default function dom(
unknown_props_check = b`
const writable_props = [${writable_props.map(prop => x`'${prop.export_name}'`)}];
@_Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith('$$')) @_console.warn(\`<${component.tag}> was created with unknown prop '\${key}'\`);
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$') @_console.warn(\`<${component.tag}> was created with unknown prop '\${key}'\`);
});
`;
}

@ -72,7 +72,7 @@ function instance($$self, $$props, $$invalidate) {
const writable_props = ["name"];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith("$$")) console.warn(`<Component> was created with unknown prop '${key}'`);
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`);
});
$$self.$set = $$props => {

@ -167,7 +167,7 @@ function instance($$self, $$props, $$invalidate) {
const writable_props = ["things", "foo", "bar", "baz"];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith("$$")) console.warn(`<Component> was created with unknown prop '${key}'`);
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`);
});
$$self.$set = $$props => {

@ -165,7 +165,7 @@ function instance($$self, $$props, $$invalidate) {
const writable_props = ["things", "foo"];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith("$$")) console.warn(`<Component> was created with unknown prop '${key}'`);
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`);
});
$$self.$set = $$props => {

@ -69,7 +69,7 @@ function instance($$self, $$props, $$invalidate) {
const writable_props = ["foo"];
Object.keys($$props).forEach(key => {
if (!writable_props.includes(key) && !key.startsWith("$$")) console.warn(`<Component> was created with unknown prop '${key}'`);
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Component> was created with unknown prop '${key}'`);
});
$$self.$set = $$props => {

Loading…
Cancel
Save