Skip to content

Add 'clear' and 'size' methods to the Map type in 'svelte/reactivity'. #10819

@MikeMcDonald83

Description

@MikeMcDonald83

Describe the bug

Thank you for adding the types from #10817 . Can you please add the 'clear' and 'size' members to the reactive map type? I assume they are already implemented as my app still works fine. VS Code is showing errors.

Similar to the referenced issue, I tried to use declaration merging to add the names. It doesn't seem to affect anything, even after clearing .svelte-kit.

Reproduction

import {Map} from 'svelte/reactivity';
const myMap = new Map<string, string>();
myMap.set("foo", "bar");
myMap.clear(); // Name not found
myMap.size // Name not found

Logs

No response

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
    CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
    Memory: 5.05 GB / 7.73 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.15.0 - /usr/local/bin/node
    npm: 9.5.0 - /usr/local/bin/npm
    bun: 1.0.30 - ~/.bun/bin/bun
  npmPackages:
    svelte: 5.0.0-next.80 => 5.0.0-next.80

Severity

annoyance

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