Skip to content

Reassignment to constant #11

@cybercode

Description

@cybercode

In a strict (typescript) environment the module fails to build due to the following error:

build failed (node_modules/node-dns-sd/lib/dns-sd.js:236:16                 v = 'address';): Cannot assign to "v" because it is a constant

the offending code:

        if ('key' in params) {
            const v = params['key']; // <---
            if (typeof (v) !== 'string' || !/^(address|fqdn)$/.test(v)) {
                return { error: new Error('The `key` is invalid.') };
            }
            if (!v) {
                v = 'address'; // <--- can't reassign to const v
            }
            p['key'] = v;
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions