Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Conversation

@activescott
Copy link
Contributor

@activescott activescott commented Jun 28, 2020

I've been using the SDK in TypeScript and I don't want to copy/paste type files around so I thought I'd try to get them into the SDK itself.


NOTE: If anyone is interested in trying these types out you can use npm add git://github.com/activescott/smartsheet-javascript-sdk.git#feat/typescript-types to use the code in this PR directly. I would love some feedback from others to help improve this or a comment indicating it worked for you would be great!


Some notes for reviewers off the type of my head:

  1. This should be a non-breaking change for JS and TS.
  2. It needs more testing to confirm - I have not run the full "mock-api" test suite locally (hoping this is done when I submit the PR)
  3. I also added a default export so that import smartsheet from "smartsheet" works now (in JS and TS). The old import * as smartsheet from "smartsheet" and require syntax should continue to work (I added tests in TS).
  4. It is NOT a comprehensive set of types, but it has the top level types defined for the default export and the client as well as an initial set for the sheet. The other resources have a default simplistic placeholder that we can add types to in the future without breaking anything.
  5. Update: Another way to get the same result here would be to start converting some files to .ts files and embed the types in there. For example, instead of adding a new lib/types/sheets/sheets.d.ts, I could just convert /lib/sheets/index.js to lib/sheets/index.ts and embed the types in there. An example of that is already done in this PR by converting /index.js to /index.ts.
    • I think long term that's the direction we'd head in. The current PR doesn't prevent transitioning to that approach, but I guess there isn't a great reason I couldn't update this PR to do just that now. If you prefer that approach let me know and I'll work on it some night or weekend.

I recommend a squash merge commit.

Testing

  • Some simplistic tests of the most top level types in test/types/index.spec.ts and are run with npm test script.
  • All tests passing at https://travis-ci.org/github/smartsheet-platform/smartsheet-javascript-sdk/pull_requests (why don't we have travis build checks on so they show up in PRs?)
  • I have tested by using npm pack locally and then installing from the tar with npm i ~/src/smartsheet-javascript-sdk/smartsheet-2.86.0.tgz and it worked in my local typescript project.
  • It would be ideal to have someone else test another similar project just to be safe. Even more ideal would be to publish the package to npm using a beta dist-tag and we could give it one more final test that way to confirm.

@activescott activescott marked this pull request as ready for review June 28, 2020 05:25
"underscore": "^1.8.2",
"winston": "^2.3.1"
},
"devDependencies": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NOTE: I did add some dependencies here. They're all dev-only, but good to review.

@mashkovtsevlx
Copy link

Please, merge these changes. They're very important.
P.S. I'll try to call them and ask to merge this.

@activescott
Copy link
Contributor Author

@timwellswa Let me know if you want more done to merge this. I'm happy to do the necessary edits and testing to implement my suggestion #5 above if that helps.

@activescott activescott force-pushed the feat/typescript-types branch from c0babc4 to 9df2723 Compare August 28, 2021 02:46
* tests for behavior and types of getSheet queryParameters option
* adds a watch script to run tests
* updates test and coverage scripts to be consistent w/ watch
* adds requestor option to ClientOptions type
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.

2 participants