Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TypeScript support #70

Open
janhesters opened this issue Dec 12, 2021 · 2 comments
Open

Add TypeScript support #70

janhesters opened this issue Dec 12, 2021 · 2 comments
Assignees

Comments

@janhesters
Copy link

Issue To Be Solved

Add support for TypeScript, so that autocomplete and other developer tooling works.

(Optional): Suggest A Solution

Solution 1: Rewrite in TypeScript

Pretty self explanatory. Would probably take weeks because TypeScript usually messes you up at edge cases. This would automatically generate type definitions when building to JavaScript.

Solution 2:

Create .d.ts file. This would have to be maintained "separately" if the code base stays in plain JavaScript. Separately means here that you might forget to update the .d.ts file and functions don't conform to it.


Comparison

Solution 1 (rewrite) is certainly more work than solution 2 (type declarations). TypeScript is widely used right now and many developers would consider it easier to contribute to the codebase after solution 1, if it was fully written in TypeScript - (which may or may not be objectively true).

(Optional): Context

Its not blocking anything, but it makes development a little harder because you always have to check out the docs and (depending on the strictness of your config) TypeScript constantly yells at you for missing types.

@gambinish
Copy link

Would love to see this implemented if possible! 😄

Running into an exact use case where our codebase is in typescript, but our testing suite for all things cadence needs to be run in js.

@adbario
Copy link
Contributor

adbario commented Aug 16, 2022

@janhesters @gambinish

Type definitions are now added for the main API functions, and they can be installed with:

npm i --save-dev @types/onflow__flow-js-testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants