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 #1125

Merged
merged 13 commits into from Jun 14, 2023
Merged

✨ Add TypeScript support #1125

merged 13 commits into from Jun 14, 2023

Conversation

segersniels
Copy link
Collaborator

@segersniels segersniels commented Jun 14, 2023

Description

This PR updates the project configuration to support TypeScript alongside Flow for a gradual conversion. The idea is to apply a boyscout rule to the codebase, if you touch a file, try to convert it to typescript as we go.

Added

  • TypeScript support added to the project.
  • New tsconfig.json file added for TypeScript configuration.
  • @babel/preset-typescript and TypeScript related devDependencies added.

Changed

  • Source files and test files have been renamed to use the .ts extension.
  • Babel configuration has been updated to support TypeScript.

Issues

@codecov
Copy link

codecov bot commented Jun 14, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.70 ⚠️

Comparison is base (c0b0ab8) 92.59% compared to head (8391284) 91.90%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1125      +/-   ##
==========================================
- Coverage   92.59%   91.90%   -0.70%     
==========================================
  Files          29       28       -1     
  Lines         297      284      -13     
  Branches       69       69              
==========================================
- Hits          275      261      -14     
- Misses         21       22       +1     
  Partials        1        1              
Impacted Files Coverage Δ
src/commands/search/index.js 75.00% <ø> (ø)

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment on lines +20 to +24
(
(meow as jest.Mock).mock.calls[0][1] as { importMeta: string }
).importMeta = 'import.meta.url'

expect(meow.mock.calls).toMatchSnapshot()
expect((meow as jest.Mock).mock.calls).toMatchSnapshot()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Bit unfortunate bit of typing going on here, but not sure what the proper way would be to handle mocked libraries.

@segersniels
Copy link
Collaborator Author

I guess we can eventually transition into using tsup to bundle when everything is transitioned from flow into typescript.

Copy link
Owner

@carloscuesta carloscuesta left a comment

Choose a reason for hiding this comment

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

Great work!! 😍

A couple of comments/suggestions

Thanks ❤️

package.json Show resolved Hide resolved
test/cli.spec.ts Outdated Show resolved Hide resolved
tsconfig.json Outdated Show resolved Hide resolved
Copy link
Owner

@carloscuesta carloscuesta left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@carloscuesta carloscuesta merged commit e4a3f19 into master Jun 14, 2023
2 of 3 checks passed
@carloscuesta carloscuesta deleted the maintenance/ts branch June 14, 2023 18:31
@carloscuesta
Copy link
Owner

I'll release a patch version with this! ❤️

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants