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

docs: typescript migration guide #31243

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Conversation

cacieprins
Copy link
Contributor

  • Closes

Additional details

Adds a guide for writing TypeScript and migrating JS to TS

Steps to test

How has the user experience changed?

PR Tasks

@cacieprins cacieprins marked this pull request as ready for review March 10, 2025 14:35
Copy link

cypress bot commented Mar 10, 2025

cypress    Run #60823

Run Properties:  status check passed Passed #60823  •  git commit f222481dc4: some edits, toc
Project cypress
Branch Review docs/ts-upgrade-guide
Run status status check passed Passed #60823
Run duration 18m 30s
Commit git commit f222481dc4: some edits, toc
Committer Cacie Prins
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 9
Tests that did not run due to a developer annotating a test with .skip  Pending 1232
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 32101
View all changes introduced in this branch ↗︎
UI Coverage  46.15%
  Untested elements 184  
  Tested elements 162  
Accessibility  92.55%
  Failed rules  3 critical   8 serious   2 moderate   2 minor
  Failed elements 876  

.map(n => String(n))
```

**Prefer** inline types. Parameter types and return types often do not need to be referenced outside of the function itself. Bag parameters (object literals with more than two properties) should be declared as a named interface. If possible, do not export this interface. If a dependent needs to reference the bag type because it is composing an object literal in preparation to call the function in question, that dependent should use `Parameters<>` instead. This way the interface name can change without necessitating a change to the dependent. Use this technique, example below, as a last resort. Prefer composing the parameter bag inline, rather than assigning it to an identifier.
Copy link
Contributor

Choose a reason for hiding this comment

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

is it worth linking out to the parameters utility type?

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.

3 participants