Comments (11)
Actually I realise the directory I linked also links to https://github.com/espruino/Espruino/blob/master/TYPESCRIPT.md which explains about auto-generating the typescript - a lot of work has gone into that, so if we can find any way to not hand-write TS declarations that would be way better.
I feel like probably we need a generic (non-bangle.js) export and to then try and get @types/espruino
updated, ideally with some instructions in there pointing back to https://github.com/espruino/Espruino/blob/master/TYPESCRIPT.md to that folks in future know how to update it
from espruinotools.
Hi,
Thanks - yes, the documentation for TypeScript on Espruino isn't great
@bobrippling when you have a moment, would you be able to jump in and provide some pointers? @bobrippling has done a huge chunk of Typescript work, especially for Bangle.js, and I believe most of that is now auto-generated: https://github.com/espruino/BangleApps/tree/master/typescript
from espruinotools.
Hey - yes I'm not familiar with @types/espruino
but I'd be happy to take a look over PRs to update it if that's what you're thinking? Let's go through the problems you found when trying to run it too, we can see what we can improve there.
How have you found setting up the repo you referenced?
from espruinotools.
I tried updating scripts/build_types.js so that the espruino.d.ts it generates matches the type definitions (http://www.espruino.com/Reference#software) in the official api documentation
from espruinotools.
Cool, do you have the branch for this?
from espruinotools.
Cool, do you have the branch for this?
I am reading through the code;
I find that scripts/build_types.js generates much better type files than the npm lib @types/espruino, so why hasn't @types/espruino been updated.
In addition, I can see that some of the type definitions could be optimized, for example, function getDetails(callback?: any): any;
The callback here could be better defined, so that the user knows the type of the callback function's arguments.
from espruinotools.
so why hasn't @types/espruino been updated.
That's a good question - maybe you could submit a PR to the project?
I can see that some of the type definitions could be optimized
If you see something you want changing you are welcome to contribute updated typings. If you find the relevant file (which you can do by going to https://www.espruino.com/Reference#software, finding the function and clicking =>
in the title) you can add typescript as mentioned in https://github.com/espruino/Espruino/blob/master/TYPESCRIPT.md to improve the automatic generation.
from espruinotools.
I'm writing a simple type inference script, and during debugging I realized that
JsVar *jswrap_wifi_getDetails(JsVar *jsCallback) {{
Is the {{
here a clerical error, when in fact only a {
is needed (This is inferred from my experience with js.)
from espruinotools.
I don't see any `{{ in that screenshot? But that file is C, not JS
from espruinotools.
I don't see any `{{ in that screenshot? But that file is C, not JS
The end of this line
from espruinotools.
Ahh, sorry - didn't spot that! Yes, that's a typo. It won't affect the code, but it's a bit ugly for sure - just fixed it
from espruinotools.
Related Issues (20)
- Remove unicode.js HOT 3
- Upload code to flash using node module HOT 2
- Cannot find bangle.js with espruino --list HOT 7
- Error EspruinoTools and JQuery 3.6.0. HOT 9
- Error after fix for electron (0.1.42) HOT 11
- CLI attempts to access UNIX socket on Windows HOT 11
- espruino --list returns "Error: No compatible USB Bluetooth 4.0 device found!" HOT 3
- Cannot connect to puck.js on raspios/bullseye/arm64 HOT 5
- Terminal support for handling color text display with ANSI escape sequences HOT 14
- Dependency "tar.gz" is deprecated and contains security vulnerabilities HOT 1
- Use CLI with IDE Relay? HOT 2
- espruino-cli: Watch mode with file argument requires process.stdin.rawMode HOT 1
- Play program HOT 5
- 404 not found during `npm install espruino` HOT 1
- Work with arm64 HOT 1
- Improvements to localModules HOT 2
- Unable to install due to error in unmaintained dependency HOT 6
- EspruinoTools to exe HOT 3
- Pretokenization broken for at least BangleApps HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from espruinotools.