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

Add TypeScript types #8

Merged
merged 10 commits into from
Sep 19, 2021
Merged

Add TypeScript types #8

merged 10 commits into from
Sep 19, 2021

Conversation

mikicho
Copy link
Contributor

@mikicho mikicho commented Sep 18, 2021

Add typescript definition file to solve ts(7016)
Fixes #5

@sindresorhus
Copy link
Owner

Thanks for creating a TypeScript definition. 🙌 Can you follow this styleguide?

Some examples:

@mikicho
Copy link
Contributor Author

mikicho commented Sep 18, 2021

@sindresorhus done.
Please let me know if I missed something.

@mikicho mikicho mentioned this pull request Sep 18, 2021

if(await isPortReachable(3000)) {
// start server
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the same example as the readme.

index.d.ts Outdated
}
```
*/
declare function isPortReachable(port: number, opts?: {timeout?: number, host?: string}): Promise<boolean>;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikicho
Copy link
Contributor Author

mikicho commented Sep 18, 2021

@sindresorhus done

index.d.ts Outdated

@default 1000
*/
timeout?: number;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use tab-indentation.

index.d.ts Outdated
/**
Can be a domain or an IP.

@default localhost
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@default localhost
@default 'localhost'

package.json Outdated
},
"files": [
"index.js"
"index.js",
"index.d.ts"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect indentation

index.d.ts Outdated
@@ -0,0 +1,31 @@
interface IsPortReachableOptions {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
interface IsPortReachableOptions {
interface Options {

@sindresorhus
Copy link
Owner

The pull request needs a proper title.

@mikicho mikicho changed the title Create index.d.ts Add typescript definition file Sep 19, 2021
@mikicho
Copy link
Contributor Author

mikicho commented Sep 19, 2021

@sindresorhus done

@sindresorhus sindresorhus changed the title Add typescript definition file Add TypeScript types Sep 19, 2021
@sindresorhus sindresorhus merged commit ce49c17 into sindresorhus:main Sep 19, 2021
@mikicho mikicho deleted the patch-1 branch September 19, 2021 08:52
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.

TypeScript Declarations
2 participants