dnsimple-node
dnsimple-node copied to clipboard
.d.ts support
Hey any plans for adding index.d.ts for typescript users?
Thanks for the request, @softmarshmallow.
At this time, there are no plans for Typescript support. That being said, I'll raise this with the team!
Hi @softmarshmallow, we've just released version 7.0.0 which migrated the library to TypeScript, so type definitions are now available for the library. It's a major version so check out the migration guide if you're currently using an older version. Let us know how it goes for you!
@wilson-dnsimple Thanks!
I tried updating my Raycast extension for DNSimple to the latest version of the package:
https://github.com/mlafeldt/dnsimple-raycast/compare/typescript
As you can see, there's some awkward code required to get hold of the actual types. I think the lib would be much more useful if those were exported as well.
Speaking of types, there's still room for improvement, e.g. with domains:
- state: string
+ state: "hosted" | "registered" | "expired"
(A domain type could even use a discriminating union.)
Anyway, it's a great start. 👍
Thanks for the feedback @mlafeldt. Version 7.1.0
has just been released, which adds explicit types that can be imported and uses unions of constant values as enum types. For example:
import { Certificate } from "dnsimple";
const certificates: Array<Certificate> = await client.certificates.listCertificates.collectAll(1010, "domain.com", { sort: "id:asc" });
Let us know any feedback you have on these changes.