ev3dev-lang-js icon indicating copy to clipboard operation
ev3dev-lang-js copied to clipboard

Expose TypeScript definitions so that they are easily accessible

Open Xstoudi opened this issue 9 years ago • 6 comments

Hey, Is there a way to use the module with typescript's import ? Thanks

Xstoudi avatar Jan 15 '16 12:01 Xstoudi

The .d.ts files should be included with the module on npm. So, if you have installed the module locally, browse to the path <project location>/node_modules/ev3dev-lang/bin (where <project location> is the place where you npm installed from) to see them. To use them from an IDE, you can either reference that relative path (the one listed above) or copy the definition files to your project directory and use them from there.

Do you think it would be helpful if I published the .d.ts files in the repo as well?

WasabiFan avatar Jan 15 '16 16:01 WasabiFan

Nop, but the way you use to make your import are outdated... After correct this, you can contribute to DefinitelyTyped/DefinitelyTyped to everybody can install with

tsd install ev3dev-lang

I'll maybe make a PR here this week-end to update definitions and on DefinitelyTyped to publish them, if it's okay to you :)

Xstoudi avatar Jan 15 '16 16:01 Xstoudi

Nop, but the way you use to make your import are outdated...

What do you mean? If there's something that I can be doing better, I'd be happy to hear it -- I am not by any means a TypeScript expert.

After correct this, you can contribute to DefinitelyTyped/DefinitelyTyped to everybody can install with

I was resisting doing that because so few people use this module at the moment -- most people who are on ev3dev are using Python. So I just didn't want to "pollute" DefinitelyTyped until there were more people that would benefit from it. But I'd be happy to try to get ev3dev-lang-js published there if you think it's useful.

I'll maybe make a PR here this week-end to update definitions and on DefinitelyTyped to publish them, if it's okay to you :)

Of course! I'll always accept PRs. But please don't open a PR against DefinitelyTyped yet so that we can make sure that the import/exports are how they should be and have some time to discuss.

WasabiFan avatar Jan 15 '16 16:01 WasabiFan

What do you mean? If there's something that I can be doing better, I'd be happy to hear it -- I am not by any means a TypeScript expert.

The TSC v1.6.2 return this error on Visual Studio Code : Error Check your version with tsc --version ^^

I was resisting doing that because so few people use this module at the moment -- most people who are on ev3dev are using Python. So I just didn't want to "pollute" DefinitelyTyped until there were more people that would benefit from it. But I'd be happy to try to get ev3dev-lang-js published there if you think it's useful.

I think you wont must worry about this, but whatever, it's your choice. ^^

Of course! I'll always accept PRs. But please don't open a PR against DefinitelyTyped yet so that we can make sure that the import/exports are how they should be and have some time to discuss. No problem.

Xstoudi avatar Jan 16 '16 14:01 Xstoudi

The TSC v1.6.2 return this error on Visual Studio Code :

Try changing your TypeScript settings for the project to target EcmaScript 5 instead. Because newer versions of Node don't support old ARM processors, we can't run ES6 on the EV3 :cry: If the TypeScript transpiler is nice enough to convert ES6 code into ES5, that shouldn't be a problem; but if it isn't, we will be needing to stick with ES5 features.

WasabiFan avatar Jan 16 '16 16:01 WasabiFan

It works, thanks :)

Xstoudi avatar Jan 16 '16 16:01 Xstoudi