This repository has been archived by the owner on Oct 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 220
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
jesstelford
commented
Sep 12, 2024
- Correctly type the mock function's return value
- Remove "@babel/traverse" dependency
Used only as types which are also available from @babel/core. This ensures the types don't get out of sync since @babel/core is sometimes listed as a peer dependency (web-worker).
jesstelford
commented
Sep 12, 2024
@@ -112,5 +112,5 @@ export default function createContext< | |||
context.request.body = requestBody; | |||
context.request.rawBody = rawBody; | |||
|
|||
return context as Context; | |||
return context as MockContext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context
is a subset of MockContext
, so this should be structurally backwards compatible.
jesstelford
commented
Sep 12, 2024
types as babelTypes, | ||
template as babelTemplate, | ||
} from '@babel/core'; | ||
|
||
import type {Options as LoaderOptions} from './webpack-parts/loader'; | ||
|
||
type Binding = BabelFile['scope']['bindings'][string]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is necessary to avoid an error under certain circumstances when the version of @babel/traverse
is incompatible with the peer dependency @babel/core
:
packages/web-worker/src/babel-plugin.ts(118,26): error TS2345: Argument of type 'Binding' is not assignable to parameter of type 'Binding'.
Investigating reveals node_modules/@types/babel__traverse
to be version 7.11.1, but node_modules/@types/babel__core/node_modules/@types/babel__traverse
is 7.20.1, which is where the conflicting versions of Binding
come from.
aminpaks
approved these changes
Sep 12, 2024
ciuliano-shopify
approved these changes
Sep 12, 2024
Merged
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.