Skip to content

<svelte:component> wrong error message on component creation #12446

Closed
@fsoft72

Description

@fsoft72

Describe the bug

During the <svelte:component> definition, if a generic function is invoked in the params definition and that function is missing, the error returned is svelte_component_invalid_this_value, while the component is a perfectly working svelte component.

This happens because in: /svelte/src/internal/client/validate.js there is this line

if (typeof message === 'string' && message.indexOf('is not a function') !== -1)

that raises the svelte_component_invalid_this_value(); wrongly

Reproduction

I have created a REPL here

As you can see on line 33, the last parameter is undefined and this throws the error function is not defined on line 27 which will be misinterpreted by Svelte

Logs

No response

System Info

System:
    OS: Linux 6.8 Ubuntu 24.04 LTS 24.04 LTS (Noble Numbat)
    CPU: (24) x64 AMD Ryzen 9 7900X 12-Core Processor
    Memory: 51.92 GB / 62.01 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    Yarn: 1.22.19 - ~/.yarn/bin/yarn
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
    pnpm: 9.5.0 - ~/.local/share/pnpm/pnpm
    bun: 1.0.0 - ~/.bun/bin/bun
  Browsers:
    Brave Browser: 125.1.66.115
    Chrome: 126.0.6478.114

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions