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

reconnecting-websockets.d.ts does not compile #44

Closed
Fredicz opened this issue Feb 25, 2015 · 9 comments
Closed

reconnecting-websockets.d.ts does not compile #44

Fredicz opened this issue Feb 25, 2015 · 9 comments

Comments

@Fredicz
Copy link

Fredicz commented Feb 25, 2015

The reconnecting-websockets.d.ts does not compile anymore after the inclusion of "public maxReconnectAttempts?: number;" into the code.
At least the TS 1.4.1 compiler complains with the following message:
"error TS1112: A class member cannot be declared optional."

@joewalnes
Copy link
Owner

I'm not familiar with typescript. Do you know the fix?

@Fredicz
Copy link
Author

Fredicz commented Feb 26, 2015

Thank you for the very fast fix! It works as expected.

@Fredicz Fredicz closed this as completed Feb 26, 2015
@Fredicz Fredicz reopened this Feb 26, 2015
@Fredicz
Copy link
Author

Fredicz commented Feb 26, 2015

The problem is actually not solved. Unfortunately my Reference.ts was still referencing the older version that did not include the error. That's why I thought it was resolved.

The ts compiler throws an error because of the question mark in line 39 of the reconnecting-websockets.d.ts (maxReconnectAttempts). It is illegal to use optional attributes in classes. They are only allowed in interfaces. Please change that. Since I use bower and cannot define the used version, I have to exclude reconnecting-websocket from the bower dependencies as long as it is not fixed properly.

@Fredicz Fredicz closed this as completed Feb 26, 2015
@Fredicz Fredicz reopened this Feb 26, 2015
@Fredicz
Copy link
Author

Fredicz commented Feb 26, 2015

I would suggest to use a Typescript interface instead of a Typescript class. That should fix the error and it should be possible since you are only describing the interface (or type).

@joewalnes
Copy link
Owner

This typescript file is making it harder to contribute to this project. Many contributions forget about it altogether, those that don't often don't know how to test it as they're not familiar with typescript.

My preference would be to remove it from this repository and allow other maintainers to keep it up to date in downstream forks if they want it.

Thoughts? Keep or delete?

/cc @drewnoakes

@Fredicz
Copy link
Author

Fredicz commented Feb 26, 2015

That would be fine for me.

@joewalnes
Copy link
Owner

I've just learned about https://github.com/borisyankov/DefinitelyTyped - a 3rd party repository of typescript definitions. If there's need for this file, it can be recreated there.

@Fredicz
Copy link
Author

Fredicz commented Feb 26, 2015

We actually use DefinetlyTyped. Thank you very much for solving the issue. Deletion of the file is perfect.

@drewnoakes
Copy link
Contributor

Seems reasonable. Relying on Definitely Typed is a decent approach. Only
downside is the lack of versioning parity.

[via phone]
On 26 Feb 2015 14:35, "Joe Walnes" notifications@github.com wrote:

This typescript file is making it harder to contribute to this project.
Many contributions forget about it altogether, those that don't often don't
know how to test it as they're not familiar with typescript.

My preference would be to remove it from this repository and allow other
maintainers to keep it up to date in downstream forks if they want it.

Thoughts? Keep or delete?

/cc @drewnoakes https://github.com/drewnoakes


Reply to this email directly or view it on GitHub
#44 (comment)
.

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

No branches or pull requests

3 participants