Skip to content

Commit f0d75e5

Browse files
committed
Include actual type of Profiler#id on type mismatch
1 parent 89d4fe1 commit f0d75e5

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

packages/react-reconciler/src/ReactFiber.new.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ function createFiberFromProfiler(
650650
): Fiber {
651651
if (__DEV__) {
652652
if (typeof pendingProps.id !== 'string') {
653-
console.error('Profiler must specify an "id" as a prop');
653+
console.error('Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.', typeof pendingProps.id);
654654
}
655655
}
656656

packages/react-reconciler/src/ReactFiber.old.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ function createFiberFromProfiler(
650650
): Fiber {
651651
if (__DEV__) {
652652
if (typeof pendingProps.id !== 'string') {
653-
console.error('Profiler must specify an "id" as a prop');
653+
console.error('Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.', typeof pendingProps.id);
654654
}
655655
}
656656

packages/react/src/__tests__/ReactProfiler-test.internal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ describe('Profiler', () => {
136136
it('should warn if required params are missing', () => {
137137
expect(() => {
138138
ReactTestRenderer.create(<React.Profiler />);
139-
}).toErrorDev('Profiler must specify an "id" as a prop', {
139+
}).toErrorDev('Profiler must specify an "id" of type `string` as a prop. Received the type `undefined` instead.', {
140140
withoutStack: true,
141141
});
142142
});

0 commit comments

Comments
 (0)