TypeScript support

Supporting Browser-based Javascript and Node.js
Post Reply
TorbjornLunde
Fresh meat
Posts: 1
Joined: Tue Jan 15, 2019 2:13 am
Contact:

TypeScript support

Post by TorbjornLunde »

Like many people I'm using TypeScript for many of my JavaScript-based projects as it provides compile time type checking, better tooling, etc…

While I can certainly use the Phidgets JavaScript library as-is considering that TypeScript is fully compatible with JavaScript. However, it would be really nice to get the usual advantages of TypeScript also when using the Phidgets library.

Are there any plans to add full support for TypeScript?

As far as I know TypeScript support can be added by (1) converting code fully into TypeScript (which compiles to readable JavaScript and can be done gradually), (2) by using type annotations in plain JavaScript or (3) by creating a TypeScript interface definition file (d.ts).

I would really appreciate having TypeScript support when using Phidgets!

In either case, thanks for creating and maintaining this wonderful hardware platform.
fast-boy
Fresh meat
Posts: 1
Joined: Mon Apr 13, 2020 2:01 pm
Contact:

Re: TypeScript support

Post by fast-boy »

Could I plus 1 a request for a @types/phidget22 package. It would save a huge amount of development time even for those using js. Thanks!
AdamLee
Phidgetly
Posts: 34
Joined: Wed Jul 17, 2019 9:28 am
Contact:

Re: TypeScript support

Post by AdamLee »

I ran into this today, and while I fully support types for Phidget22 via DefinitelyTyped, I wound up just doing this to get around compiler errors:

// @ts-ignore
import phidget22 from 'phidget22';

From there I added my own type definition file just to cover the methods I'm using. Not ideal but it gets around errors.
Adam Lee
Software Engineer
www.activatedresearch.com
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests