Skip to content

Commit 5cbc959

Browse files
committed
internal: jest 30 config update
1 parent b58f6c4 commit 5cbc959

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ jobs:
156156
- run:
157157
# we must use npm because yarn 4 isn't compatible with legacy node versions
158158
command: |
159-
ANANSI_JEST_TYPECHECK=false yarn test --ci --maxWorkers=2 --selectProjects Node
159+
ANANSI_JEST_TYPECHECK=false yarn test --ci --selectProjects Node
160160
161161
setup-esmodule-types:
162162
executor: node

jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ process.env.ANANSI_JEST_BABELCONFIG = 'babel.config.js';
22
process.env.ANANSI_JEST_TSCONFIG = 'tsconfig.test.json';
33

44
const baseConfig = {
5+
testEnvironmentOptions: {
6+
globalsCleanup: 'on',
7+
},
58
preset: '@anansi/jest-preset',
69
moduleFileExtensions: [
710
'ts',

website/src/components/Playground/editor-types/react.d.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ declare namespace React {
135135
props: P,
136136
) => ReactNode | Promise<ReactNode>)
137137
// constructor signature must match React.Component
138-
| (new(props: P) => Component<any, any>);
138+
| (new(props: P, context: any) => Component<any, any>);
139139

140140
/**
141141
* Created by {@link createRef}, or {@link useRef} when passed `null`.
@@ -218,7 +218,7 @@ declare namespace React {
218218
type ElementRef<
219219
C extends
220220
| ForwardRefExoticComponent<any>
221-
| { new(props: any): Component<any> }
221+
| { new(props: any, context: any): Component<any> }
222222
| ((props: any) => ReactNode)
223223
| keyof JSX.IntrinsicElements,
224224
> = ComponentRef<C>;
@@ -928,7 +928,7 @@ declare namespace React {
928928
static propTypes?: any;
929929

930930
/**
931-
* If using the new style context, re-declare this in your class to be the
931+
* If using React Context, re-declare this in your class to be the
932932
* `React.ContextType` of your `static contextType`.
933933
* Should be used with type annotation or static contextType.
934934
*
@@ -947,6 +947,14 @@ declare namespace React {
947947

948948
// Keep in sync with constructor signature of JSXElementConstructor and ComponentClass.
949949
constructor(props: P);
950+
/**
951+
* @param props
952+
* @param context value of the parent {@link https://react.dev/reference/react/Component#context Context} specified
953+
* in `contextType`.
954+
*/
955+
// TODO: Ideally we'd infer the constructor signatur from `contextType`.
956+
// Might be hard to ship without breaking existing code.
957+
constructor(props: P, context: any);
950958

951959
// We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
952960
// See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
@@ -1118,7 +1126,14 @@ declare namespace React {
11181126
*/
11191127
interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
11201128
// constructor signature must match React.Component
1121-
new(props: P): Component<P, S>;
1129+
new(
1130+
props: P,
1131+
/**
1132+
* Value of the parent {@link https://react.dev/reference/react/Component#context Context} specified
1133+
* in `contextType`.
1134+
*/
1135+
context?: any,
1136+
): Component<P, S>;
11221137
/**
11231138
* Ignored by React.
11241139
* @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
@@ -1158,7 +1173,7 @@ declare namespace React {
11581173
*/
11591174
type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
11601175
& C
1161-
& (new(props: P) => T);
1176+
& (new(props: P, context: any) => T);
11621177

11631178
//
11641179
// Component Specs and Lifecycle

0 commit comments

Comments
 (0)