Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown prop using export let and export function - error comeback #7474

Closed
lukaszpolowczyk opened this issue Apr 20, 2022 · 4 comments
Closed
Labels

Comments

@lukaszpolowczyk
Copy link

lukaszpolowczyk commented Apr 20, 2022

Describe the bug

It's the same problem:
#4323

Reproduction

This is the REPL from that bug:
https://svelte.dev/repl/79aa242f7e6d4af684099868189d3cb4?version=3.18.0

If you click on button "toggle modal" in console you should have this warning:

"

was created with unknown prop 'saveForm'"

Logs

No response

System Info

System:
    OS: Linux 5.10 Arch Linux
    CPU: (4) x64 AMD Athlon(tm) X4 950 Quad Core Processor
    Memory: 1.73 GB / 15.07 GB
    Container: Yes
    Shell: 5.1.8 - /bin/bash
  Binaries:
    Node: 16.3.0 - /usr/bin/node
    Yarn: 1.22.10 - /usr/bin/yarn
    npm: 7.17.0 - /usr/bin/npm
  Browsers:
    Brave Browser: 100.1.37.109
    Firefox: 87.0

Severity

annoyance

@bluwy bluwy added the bug label Apr 20, 2022
@gtm-nayan
Copy link
Contributor

I may have misunderstood but if the bug is the unknown prop warning then here's a simpler repro: https://svelte.dev/repl/3b8631768b874557b3987bdd10e29d76?version=3.47.0

Warning seems to stem from line 3 in App.svelte, where null is assigned to thing (also if you assign any value to thing other than undefined)

Arguably export function is a one way binding from the child to the parent and shouldn't get a value from the parent and the warning is expected behavior here.

@lukaszpolowczyk
Copy link
Author

@gtm-nayan The expected behavior?

And how to do it differently so that the warning doesn't display?
The function exported from C.svelte, must work inside it, because it refers to inside it.

@gtm-nayan
Copy link
Contributor

@gtm-nayan The expected behavior?

For me it is, but the consensus might be different.

And how to do it differently so that the warning doesn't display?

Just don't assign anything to the receiver of the binding and the warning goes away. (undefined is fine). In my repl, it'd be changing let thing = null; to let thing;, in your repl it'd be changing export let saveForm = null to export let saveForm = undefined; inside Wrapper.svelte.

@Rich-Harris
Copy link
Member

We got rid of these warnings in Svelte 5, so I'll close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants