Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup types for package #36

Merged
merged 1 commit into from
May 21, 2021
Merged

Conversation

AKorezin
Copy link
Contributor

@AKorezin AKorezin commented Apr 14, 2021

Q A
Bug fix? yes
New feature? no
Deprecations? no
Tickets no
License MIT

Summary

Export all types as module like done in @types/node.

Any interfaces and types of this modules now can be imported.

import whoiser, {OptionsGeneric, WhoisSearchResult} from 'whoiser';
const customOptions: OptionsGeneric = {timeout: 10000}; // this const is of type Options, not an object
const request = 'example.com';
const result = await whoiser(request, customOptions);

Add Options interface for generic options.

Add different options types for every function with options.
So all function will have their own list of parameters.
And the default export will have universal parameters for all of them.

Add known result type for whois search functions.

I expect that every result will be at least empty object {}.
But if everything is ok the result will be an object

{
  "Domain Name": "sample.domain.name",
  "Registrar": "sample.registrar.name",
  "Group": [
    "item1",
    "item2",
    "item3"
  ],
  "RecursiveProperty": {
    "propertyIsAString": "a string property",
    "propertyIsAnArray": [
      "an array property item1",
      "an array propery item2"
    ],
    "oneLevelDeeper": {
      "deepPropery": "deep property value"
    }
  }
}

Export all types as module
Add Options interface for generic options
Add different options types for every function with options
Add known result type for whois search functions
@AKorezin
Copy link
Contributor Author

@AndreiIgna

@AndreiIgna
Copy link
Member

Hey @AKorezin, thanks for improving this and adding the detailed comments. This is merged and I will create a release by tomorrow

@AndreiIgna AndreiIgna merged commit d2ad403 into LayeredStudio:master May 21, 2021
@AKorezin AKorezin deleted the types_fix branch August 10, 2021 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants