-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add TypeScript definitions for the api #536
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Disclaimer: I am not a typescript user, and there is no one in the maintainers. In #386 it was discussed this matter. I'm happy to embed the type definition here, if you want to help maintaining that. |
Yeah, keen! we at @flomio are going full TypeScript.
|
@sublimator send a PR, I'll add you then. |
k, once we got the other one sorted to your satisfaction, I'll get onto it :) |
I am using mqtt.js with TypeScript. I can contribute if you need my help. |
Awesome :) There's a @types/mqtt package we can work with it's author with
:)
Just to find the time ...
|
I wrote the type definitions for the MQTT API v1. I was hoping that one day I'll write another definitions for v2 API also. Because a lot of time has passed and nothing happened from my part, I must say it would be great if someone else could do the new type definitions. Anyway, to write the type definitions, you should take the API documentation and write the definitions from there. The missing parts can be found from the source. And make PR for the documentation, if there is something missing. Also notice that the two versions of the type definitions can co-exist, if the API v1 is still maintained actively. If it's not maintained, one should rewrite the existing file. |
I've been playing with async/await in TypeScript 2.1 and it's lovely. It would be nice to Promise-able the API while we're at it. |
And DefinitelyTypes repo must be updated as well. |
I installed mqtt 2.5.0 by "npm install mqtt", but type definition files are not provided. |
this should be done now in 2.5.1 |
@sublimator |
Can you verify that you have the typings in your node_modules/mqtt ? Are you using @mcollina's latest npm push of mqtt? What version of typescript? |
|
Interesting, as it "works for me" here.
Is all I'm using. |
My tsconfig.json is as follows.
The result of trace resolution is like this. The tsc compiler is trying to search the module in node_modules/@types/mqtt.d.ts. But not in node_modules/mqtt/types/index.d.ts.
|
I'm using moduleResolution: "node"
Try that?
|
I'm relatively new to TypeScript btw
|
I'm using it with an angular 4 app, that was scaffolded by the angular cli,
which creates a tsconfig file with `compilerOptions.moduleResolution`, set
to `node`
|
Thanks. I fixed it with the "moduleResolution: Node" in the "compilerOptions".
|
We should update the TypeScript section of the README I guess |
PR? |
Done. We might wanna add some CI tests that use all the |
Actually, there exists a
@types/mqtt
(which happens to be inconsistent with this latest version) but of course it would be ideal to have it in this repo (which is considered the best practice I believe).The text was updated successfully, but these errors were encountered: