lifx-http-api
lifx-http-api copied to clipboard
✨🔧📝 Adding Typescript definition files
This way, the package can be used in Typescript projects.
It also should add Intellisense support for VSCode in JS or TS.
Thanks for another contribution @dudeofawesome. I'll check out the PR in a few and let you know what I'm thinking about it but it looks good so far.
Hey, what's the status on this?
Understood that. What about all the other interfaces you included? They're inaccessible from a void.
On Mar 18, 2017, 4:17 AM -0700, Louis Orleans [email protected], wrote:
@dudeofawesome commented on this pull request.
In dist/lifx.d.ts (https://github.com/klarstil/lifx-http-api/pull/3#discussion_r106778825):
@@ -0,0 +1,8 @@ +declare module 'lifx-http-api' { + interface ILifxOptions { + bearerToken: string; + } + + const LifxHTTPAPI: (options: ILifxOptions) => void;
The goal of this file is to allow for
const lifx = require('lifx-http-api'); new lifx({ … });
The return type of a constructor must be void in TypeScript
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub (https://github.com/klarstil/lifx-http-api/pull/3#discussion_r106778825), or mute the thread (https://github.com/notifications/unsubscribe-auth/AAONwJ5ZLCVPXJ0D883ommrMMetKT-Foks5rm71KgaJpZM4LnXFt).
For an example of how this works, you can check out my Travis CI build light project: https://github.com/dudeofawesome/ci-stoplight
I create a new LifxClient
here, which is then injected in to my LifxController
class here, and later used in a few places within that class, including here.
The constructor
method of a class always has a return type of void
.
When you say you don't see any hinting, do you mean that you've attempted to use, but when you instantiate a new instance, the type returned is any
?
@klarstil What's the status of this?