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

Move typings to src and update reference in package.json #18

Closed
wants to merge 1 commit into from
Closed

Conversation

freddydumont
Copy link

What: Fix #17

Proposed solution for #17

Checklist:

  • Documentation
  • Tests
  • Ready to be merged
  • Added myself to contributors table

@@ -3,7 +3,7 @@
"version": "0.0.0-semantically-released",
"description": "Simple and complete custom Cypress commands and utilities that encourage good testing practices.",
"main": "dist/index.js",
"typings": "typings",
"typings": "dist/typings",
Copy link
Member

Choose a reason for hiding this comment

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

Instead of moving the files, could we just include typings in the files property here?

Copy link
Author

Choose a reason for hiding this comment

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

That's what I tried first but for some reason it wasn't working. I assume it's because of the way kcd-scripts build works. It seems to take files from src only.

@kentcdodds
Copy link
Member

I fixed this :) Thanks!

@kentcdodds
Copy link
Member

🎉 This issue has been resolved in version 2.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@aaronmcadam
Copy link
Collaborator

Hi @freddydumont, have you managed to get typings to work? I'm still having problems that I thought I'd solved with #16

@aaronmcadam
Copy link
Collaborator

It looks like it needs a generic, but I can't get my definition overrides to work locally.

@freddydumont
Copy link
Author

Hi @aaronmcadam, I'm not using typescript. My issue was that the lack of typings broke editor autocompletion, which is especially annoying when chaining functions. The latest release didn't fix the issue and I moved on because I don't know enough typescript to fix it.

What I did notice is that the typings here are very different than what is included in the cypress package, where they include the whole function signature.

@airato airato mentioned this pull request Nov 3, 2018
4 tasks
kentcdodds pushed a commit that referenced this pull request Nov 6, 2018
<!--
Thanks for your interest in the project. Bugs filed and PRs submitted are appreciated!

Please make sure that you are familiar with and follow the Code of Conduct for
this project (found in the CODE_OF_CONDUCT.md file).

Also, please make sure you're familiar with and follow the instructions in the
contributing guidelines (found in the CONTRIBUTING.md file).

If you're new to contributing to open source projects, you might find this free
video course helpful: http://kcd.im/pull-request

Please fill out the information below to expedite the review and (hopefully)
merge of your pull request!
-->

<!-- What changes are being made? (What feature/bug is being fixed here?) -->

**What**: 
- fixed TypeScript types
- added jsdoc for helpers
- added tests for types

<!-- Why are these changes necessary? -->

**Why**: types were not working
reported here #18 (comment) by @aaronmcadam and @freddydumont

<!-- How were these changes implemented? -->

**How**: 
- added and fixed types for the helpers into Cypress namespace using global declaration as described in TS docs https://www.typescriptlang.org/docs/handbook/declaration-files/templates/global-modifying-module-d-ts.html
- for testing - added `tsc --noemit` on sample ts project

<!-- Have you done all of these things?  -->

**Checklist**:

<!-- add "N/A" to the end of each line that's irrelevant to your changes -->

<!-- to check an item, place an "x" in the box like so: "- [x] Documentation" -->

* [x] Documentation 
* [x] Tests
* [x] Ready to be merged <!-- In your opinion, is this ready to be merged as soon as it's reviewed? -->
* [x] Added myself to contributors table <!-- this is optional, see the contributing guidelines for instructions -->

<!-- feel free to add additional comments -->

This is how types being picked up by VS-Code:

![image](https://user-images.githubusercontent.com/4506749/47946634-840d6d80-decb-11e8-9be7-62fb2a68526e.png)


![image](https://user-images.githubusercontent.com/4506749/47946573-9e931700-deca-11e8-94e0-4fd6bd70ce4c.png)
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

Successfully merging this pull request may close these issues.

Typings aren't included in built package
3 participants