Skip to content

TypeScript definitions unhappy with BIND options #3946

@andrewimeson

Description

@andrewimeson

Describe the bug

Following the documentation to configure BIND with additional settings (e.g. custom SOA values) produces a dnsconfig.js that the current (v4.29.0) TypeScript definitions are unhappy with.

To Reproduce

Create a dnsconfig.js with the following:

// @ts-check
/// <reference path="types-dnscontrol.d.ts" />
var REG_NONE = NewRegistrar('none');
var DSP_BIND = NewDnsProvider("bind", {
    "default_soa": {
        "master": "ns1.example.com.",
        "mbox": "spamtrap.example.com.",
        "refresh": 3600,
        "retry": 600,
        "expire": 604800,
        "minttl": 1440,
    },
    "default_ns": [
        "ns1.example.com.",
        "ns2.example.com.",
        "ns3.example.com.",
        "ns4.example.com."
    ]
})

D(
  'example.com',
  REG_NONE,
  DnsProvider(DSP_BIND),
  DefaultTTL(300),
  A('@', '192.0.2.1'),
);

and creds.json

{
  "none": {
    "TYPE": "NONE"
  },
  "bind": {
    "TYPE": "BIND",
  }
}

This will successfully compile (dnscontrol push) with no errors and the expected zone file, but the TypeScript checker is unhappy:

$ npx --yes tsc
dnsconfig.js:4:39 - error TS2345: Argument of type '{ default_soa: { master: string; mbox: string; refresh: number; retry: number; expire: number; minttl: number; }; default_ns: string[]; }' is not assignable to parameter of type 'string'.

  4 var DSP_BIND = NewDnsProvider("bind", {
                                          ~
  5     "default_soa": {
    ~~~~~~~~~~~~~~~~~~~~
...
 18     ]
    ~~~~~
 19 })
    ~

Expected behavior

The types to view it as valid.

DNS Provider

  • BIND

I'm not sure I'm TypeScript/JS savvy enough to create the fix.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions