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

Added typings #27

Merged
merged 5 commits into from
May 28, 2018
Merged

Added typings #27

merged 5 commits into from
May 28, 2018

Conversation

SachsKaylee
Copy link
Contributor

@SachsKaylee SachsKaylee commented May 27, 2018

Merging the types into the main repository is definitely better than having a separate one, I agree(See PR #24).

Let me just explain the added files:

  • d/index.d.ts - The definitions live here.
  • tsconfig.json - Includes directives for the project that includes sockette on where to find the types, etc. Not a lot since we don't actually compile sockette using the TS compiler.

And obviously an added hint in the Readme.
I just specified the latest Version of TypeScript in the package.json, although it should probably work with older ones as well. We're not really using any special features.

Copy link
Owner

@lukeed lukeed left a comment

Choose a reason for hiding this comment

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

Hey, thanks for this!

I think this may be more than what we actually need for including typings.

A few of my repos have been PR'd with types & all you really need is the *.d.ts to be added, add that same file to files array in package.json and then add a new "types": "{NAME}.d.ts" to the package.json as well.

If things have drastically changed, let me know, but I dont imagine that they have.

readme.md Outdated
@@ -160,6 +160,9 @@ If [`options.maxAttempts`](#optionsmaxattempts) has not been exceeded, enqueues

Initializes a new `WebSocket` — used on initialization and by [`reconnect()`](#reconnect).

## TypeScript
Copy link
Owner

Choose a reason for hiding this comment

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

Let's not include this. Those who have TS on will see it automatically.

tsconfig.json Outdated
@@ -0,0 +1,13 @@
{
Copy link
Owner

Choose a reason for hiding this comment

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

Pretty sure we don't need this file either.

package.json Outdated
@@ -1,6 +1,7 @@
{
"name": "sockette",
"version": "2.0.0",
"typeScriptVersion": "2.8",
Copy link
Owner

Choose a reason for hiding this comment

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

Don't need this bad boy.

@SachsKaylee
Copy link
Contributor Author

Okay, thanks for the info! Is the entry in files in package.json required? In my test environment it works without it. I also couldn't find any reference to this in the official guide: https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html

@lukeed
Copy link
Owner

lukeed commented May 27, 2018

Yeah, it's required. The npm registry only saves/uploads the contents of "files" when specified. So it works on your machine because it exists for you already.

@lukeed
Copy link
Owner

lukeed commented May 28, 2018

Looks good, thank you~!

@lukeed lukeed merged commit f3be7f2 into lukeed:master May 28, 2018
@SachsKaylee SachsKaylee deleted the typings branch May 28, 2018 18:28
SachsKaylee pushed a commit to SachsKaylee/types-sockette that referenced this pull request May 28, 2018
See sockette PR#27 lukeed/sockette#27
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.

2 participants