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

chore(gatsby): Convert cache.js to TypeScript #20626

Merged
merged 9 commits into from
Jan 16, 2020
Merged

Conversation

ascorbic
Copy link
Contributor

Description

Trying again with #20622 to see if I can preserve history. This includes the changes to enable Jest to run on TypeScript files that were in #20457. It also has a couple of additions to tsconfig to reflect the fact we're running in Node not the browser

Documentation

n/a

Related Issues

#20457

@ascorbic ascorbic requested a review from a team as a code owner January 15, 2020 15:39
Copy link
Contributor

@pvdz pvdz left a comment

Choose a reason for hiding this comment

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

I think the Cache should have a type parameter since all inputs/outputs are of the same type. If you type it on the methods then the same Cache instance could be called with different types and the types wouldn't mean much...

Am I wrong? Maybe it works a little different from Flow.

packages/gatsby/src/utils/cache.ts Show resolved Hide resolved
packages/gatsby/src/utils/cache.ts Outdated Show resolved Hide resolved
pvdz
pvdz previously approved these changes Jan 15, 2020

beforeEach(() => {
manager.caching.mockReset()
fs.ensureDirSync.mockReset()
;(manager.caching as jest.Mock).mockReset()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prettier insists

Copy link
Contributor

Choose a reason for hiding this comment

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

that's normal :) because else it could be a return function of mockReset

Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

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

Awesome! 👏 👏 👏

@wardpeet wardpeet merged commit 6d63b32 into master Jan 16, 2020
@wardpeet wardpeet deleted the typescript-cache-js-ts branch January 16, 2020 10:48
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.

4 participants