Skip to content
This repository was archived by the owner on Jul 8, 2024. It is now read-only.

Add typescript types#58

Open
corollari wants to merge 1 commit into
Swyftx:mainfrom
corollari:dev
Open

Add typescript types#58
corollari wants to merge 1 commit into
Swyftx:mainfrom
corollari:dev

Conversation

@corollari
Copy link
Copy Markdown

This PR adds typescript types to the public API. I tried to be the least invasive possible with the current code and setup (without sacrificing type checking) so I simply converted some files into typescript and made typescript emit the declaration files.

The only changes to the build process will be:

  • When building the code, npm run build-ts will need to be run in order to generate currencies.js and wallet_address_validator.js
  • These two .js files should be treated as simple build artifacts, all new code changes should be applied to the .ts files instead.

@corollari
Copy link
Copy Markdown
Author

@GusGold thoughts?

Comment thread src/currencies.ts
name: string,
symbol: string,
validator: {
// `currency` must be `any` to avoid recureferences
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the typescript seems to have no problem with recursive types. Or is it not so? Perhaps it is worth updating the request?

@dartess
Copy link
Copy Markdown

dartess commented Nov 1, 2021

@mdcuk34 Do you plan to update the request to make merge possible?

@GusGold How do you look at this request? #49 here you are not against typescript. Should @mdcuk34 update this request?

Personally, it seems to me that in this case it would be more correct to put the declaration file at the root, instead of changing the build process.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants