Skip to content

anchorNorth, anchorSouth, anchorEast, anchorWest work at runtime but not when type checking #547

Open
@rudolfbyker

Description

@rudolfbyker

Description

It seems that the <Node>s have snippets called anchorNorth, anchorSouth, anchorEast, and anchorWest. They work at runtime, and they are the most convenient way that I could find to put my custom anchors in the correct positions on the edges of the custom Node. However, they are not documented, and when running svelte-check, it tells me that I'm not allowed to use them:

Error: Object literal may only specify known properties, and 'anchorNorth' does not exist in type 'Properties<{ position?: { x: number; y: number; } | undefined; drop?: false | "center" | "cursor" | undefined; dimensions?: InitialDimensions | null | undefined; id?: string | number | undefined; ... 23 more ...; title?: string | undefined; }, { ...; }>'. (ts)

Reproduction

  <Node position={{ x: 100, y: 0 }} let:selected>
    <div
      class:selected
      class="border-surface-100-900 bg-primary-100-900 rounded-md border-1 p-4 text-lg font-bold"
    >
      The node
    </div>

    {#snippet anchorSouth()}
      <Anchor
        locked
        direction="south"
        output
        let:linked
      >
        <CircleChevronDown
          color={linked ? "green" : "gray"}
          class="rounded-full bg-white"
        />
      </Anchor>
    {/snippet}
  </Node>

Code sandbox coming soon ...

System information

  System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1195G7 @ 2.90GHz
    Memory: 37.90 GB / 63.74 GB
  Binaries:
    Node: 22.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 10.7.0 - C:\Program Files\nodejs\pnpm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.86)
    Internet Explorer: 11.0.19041.4355
  npmPackages:
    @lucide/svelte: ^0.503.0 => 0.503.0
    svelte: ^5.28.2 => 5.28.2
    svelvet: ^11.0.5 => 11.0.5
    tailwindcss: ^4.1.4 => 4.1.4

Additional information

No response

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd love to make a PR to fix this bug!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions