GetScatter / scatter-js

Importable JavaScript library that allows web applications to directly interface with Scatter Desktop, Classic and Mobile.
MIT License
262 stars 148 forks source link

Add first batch of TypeScript declarations #142

Closed matei-radu closed 2 years ago

matei-radu commented 5 years ago

This PR adds the first chunk of TypeScript declarations to the existing code base as requested in #39.

Overall I believe these types are imperfect but still a good starting point. Over time we will iterate and improve them through usage and developer feedback.

What is included

The focus is on most of the commonly used features of @scatter-js/core, such as:

In addition, typings for @scatter-js/eosjs2 and @scatter-js/lynx plugins are added.

What is not included

matei-radu commented 5 years ago

@AnyPang :smile:

AnyPang commented 5 years ago

@matei-radu It's great! I use it in Egret,and it has the following compiling errors: Error scatter-js/packages/core/types/index.d.ts (144,13): A rest parameter must be of an array type. Error scatter-js/packages/core/types/index.d.ts (144,24): Cannot find name 'Parameters'. Error scatter-js/packages/core/types/index.d.ts (144,57): Cannot find name 'ReturnType'. Maybe the Egret has the lower version of the Typescripts compiler.How should I fix these errors?

matei-radu commented 5 years ago

Thanks for finding this!

I don't know what Egret is but you need TypeScript version 3.1 or above to use these types, which was released more than a year ago.

nsjames commented 5 years ago

Awesome! Gonna go over these tomorrow <3

nsjames commented 4 years ago

So, everything looks good at a glance (haven't pulled locally yet), but how does this handle the dynamically added methods such as ScatterJS.eos()?