Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/react-devtools-inline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ If you're looking for the standalone React DevTools UI, **we suggest using [`rea

---

> **Note** that this package (and the DevTools UI) relies on several _experimental_ APIs that are **only available in the [experimental release channel](https://reactjs.org/docs/release-channels.html#experimental-channel)**. This means that you will need to install `react@experimental` and `react-dom@experimental`.
> **Note** that this package (and the DevTools UI) relies on several _experimental_ APIs that are **only available in the [experimental release channel](https://react.dev/community/versioning-policy#experimental-channel)**. This means that you will need to install `react@experimental` and `react-dom@experimental`.

---

Expand Down
2 changes: 1 addition & 1 deletion packages/react-devtools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ By default DevTools listen to port `8097` on `localhost`. The port can be modifi

Or you could develop with a local HTTP server like [`serve`](https://www.npmjs.com/package/serve).

**The React tab won't show up if the site doesn't use React**, or if React can't communicate with the devtools. When the page loads, the devtools sets a global named `__REACT_DEVTOOLS_GLOBAL_HOOK__`, then React communicates with that hook during initialization. You can test this on the [React website](https://reactjs.org/) or by inspecting [Facebook](https://www.facebook.com/).
**The React tab won't show up if the site doesn't use React**, or if React can't communicate with the devtools. When the page loads, the devtools sets a global named `__REACT_DEVTOOLS_GLOBAL_HOOK__`, then React communicates with that hook during initialization. You can test this on the [React website](https://react.dev/) or by inspecting [Facebook](https://www.facebook.com/).

**If your app is inside of CodePen**, make sure you are registered. Then press Fork (if it's not your pen), and then choose Change View > Debug. The Debug view is inspectable with DevTools because it doesn't use an iframe.

Expand Down
2 changes: 1 addition & 1 deletion packages/react-test-renderer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This package provides an experimental React renderer that can be used to render

Essentially, this package makes it easy to grab a snapshot of the "DOM tree" rendered by a React DOM or React Native component without using a browser or jsdom.

Documentation: [https://reactjs.org/docs/test-renderer.html](https://reactjs.org/docs/test-renderer.html)
Documentation: [https://react.dev/reference/react-dom/test-utils](https://react.dev/reference/react-dom/test-utils)

Usage:

Expand Down
2 changes: 1 addition & 1 deletion packages/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ React is a JavaScript library for creating user interfaces.

The `react` package contains only the functionality necessary to define React components. It is typically used together with a React renderer like `react-dom` for the web, or `react-native` for the native environments.

**Note:** by default, React will be in development mode. The development version includes extra warnings about common mistakes, whereas the production version includes extra performance optimizations and strips all error messages. Don't forget to use the [production build](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build) when deploying your application.
**Note:** by default, React will be in development mode. The development version includes extra warnings about common mistakes, whereas the production version includes extra performance optimizations and strips all error messages. Don't forget to use the [production build](https://react.dev/learn/render-and-commit#optimizing-performance) when deploying your application.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion packages/use-sync-external-store/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# use-sync-external-store

Backwards-compatible shim for [`React.useSyncExternalStore`](https://reactjs.org/docs/hooks-reference.html#usesyncexternalstore). Works with any React that supports Hooks.
Backwards-compatible shim for [`React.useSyncExternalStore`](https://react.dev/reference/react/useSyncExternalStore). Works with any React that supports Hooks.

See also https://github.com/reactwg/react-18/discussions/86.
71 changes: 40 additions & 31 deletions scripts/jest/typescript/jest.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,37 @@ declare const __DEV__: boolean;
declare const __TEST__: boolean;
declare const __EXTENSION__: boolean;

declare function afterEach(fn: any): any;
declare function beforeEach(fn: any): any;
declare function describe(name: string, fn: any): void;
declare function afterEach(fn: () => void | Promise<void>): void;
declare function beforeEach(fn: () => void | Promise<void>): void;
declare function describe(name: string, fn: () => void): void;
declare const it: {
(name: string, fn: any): void;
only: (name: string, fn: any) => void;
(name: string, fn: () => void | Promise<void>): void;
only: (name: string, fn: () => void | Promise<void>) => void;
};
declare function expect(val: any): Expect;
declare function expect<T = any>(val: T): Expect<T>;
declare const jest: Jest;
declare function pit(name: string, fn: any): void;
declare function spyOnDev(obj: any, key: string): any;
declare function spyOnDevAndProd(obj: any, key: string): any;
declare function spyOnProd(obj: any, key: string): any;
declare function xdescribe(name: string, fn: any): void;
declare function xit(name: string, fn: any): void;
declare function pit(name: string, fn: () => Promise<void>): void;
declare function spyOnDev<T extends object, M extends keyof T>(
obj: T,
key: M
): MockFunction<T[M]>;
declare function spyOnDevAndProd<T extends object, M extends keyof T>(
obj: T,
key: M
): MockFunction<T[M]>;
declare function spyOnProd<T extends object, M extends keyof T>(
obj: T,
key: M
): MockFunction<T[M]>;
declare function xdescribe(name: string, fn: () => void): void;
declare function xit(name: string, fn: () => void | Promise<void>): void;

interface Expect {
not: Expect;
interface Expect<T = any> {
not: Expect<T>;
toThrow(message?: string): void;
toThrowError(message?: string): void;
toBe(value: any): void;
toEqual(value: any): void;
toBe(value: T): void;
toEqual(value: T): void;
toBeFalsy(): void;
toBeTruthy(): void;
toBeNull(): void;
Expand All @@ -35,37 +44,37 @@ interface Expect {
toBeGreaterThan(number: number): void;
toBeLessThan(number: number): void;
toBeCalled(): void;
toBeCalledWith(...arguments): void;
lastCalledWith(...arguments): void;
toBeCalledWith(...args: any[]): void;
lastCalledWith(...args: any[]): void;
}

interface Jest {
autoMockOff(): void;
autoMockOn(): void;
clearAllTimers(): void;
dontMock(moduleName: string): void;
genMockFromModule(moduleObj: Object): Object;
genMockFunction(): MockFunction;
genMockFn(): MockFunction;
genMockFromModule(moduleObj: object): object;
genMockFunction<T = any>(): MockFunction<T>;
genMockFn<T = any>(): MockFunction<T>;
mock(moduleName: string): void;
runAllTicks(): void;
runAllTimers(): void;
runOnlyPendingTimers(): void;
setMock(moduleName: string, moduleExports: Object): void;
setMock(moduleName: string, moduleExports: object): void;
}

interface MockFunction {
(...arguments): any;
interface MockFunction<T = any> {
(...args: any[]): any;
mock: {
calls: Array<Array<any>>;
instances: Array<Object>;
instances: Array<object>;
};
mockClear(): void;
mockImplementation(fn: Function): MockFunction;
mockImpl(fn: Function): MockFunction;
mockReturnThis(): MockFunction;
mockReturnValue(value: any): MockFunction;
mockReturnValueOnce(value: any): MockFunction;
mockClear(): MockFunction<T>;
mockImplementation(fn: (...args: any[]) => any): MockFunction<T>;
mockImpl(fn: (...args: any[]) => any): MockFunction<T>;
mockReturnThis(): MockFunction<T>;
mockReturnValue(value: any): MockFunction<T>;
mockReturnValueOnce(value: any): MockFunction<T>;
}

declare const check: any;
Expand Down