Skip to content

Commit

Permalink
Include actual type of Profiler#id on type mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Nov 20, 2020
1 parent 89d4fe1 commit f0d75e5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiber.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ function createFiberFromProfiler(
): Fiber {
if (__DEV__) {
if (typeof pendingProps.id !== 'string') {
console.error('Profiler must specify an "id" as a prop');
console.error('Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.', typeof pendingProps.id);
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiber.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ function createFiberFromProfiler(
): Fiber {
if (__DEV__) {
if (typeof pendingProps.id !== 'string') {
console.error('Profiler must specify an "id" as a prop');
console.error('Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.', typeof pendingProps.id);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('Profiler', () => {
it('should warn if required params are missing', () => {
expect(() => {
ReactTestRenderer.create(<React.Profiler />);
}).toErrorDev('Profiler must specify an "id" as a prop', {
}).toErrorDev('Profiler must specify an "id" of type `string` as a prop. Received the type `undefined` instead.', {
withoutStack: true,
});
});
Expand Down

0 comments on commit f0d75e5

Please sign in to comment.