Skip to content

Commit a9d63f3

Browse files
authored
fix: incorrect type in getTypeSymbol (#32825)
`getTypeSymbol` also returns string
1 parent 6a7650c commit a9d63f3

File tree

1 file changed

+3
-4
lines changed
  • packages/react-devtools-shared/src/backend/fiber

1 file changed

+3
-4
lines changed

packages/react-devtools-shared/src/backend/fiber/renderer.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ function createVirtualInstance(
248248
type DevToolsInstance = FiberInstance | VirtualInstance | FilteredFiberInstance;
249249

250250
type getDisplayNameForFiberType = (fiber: Fiber) => string | null;
251-
type getTypeSymbolType = (type: any) => symbol | number;
251+
type getTypeSymbolType = (type: any) => symbol | string | number;
252252

253253
type ReactPriorityLevelsType = {
254254
ImmediatePriority: number,
@@ -541,13 +541,12 @@ export function getInternalReactConstants(version: string): {
541541
// End of copied code.
542542
// **********************************************************
543543

544-
function getTypeSymbol(type: any): symbol | number {
544+
function getTypeSymbol(type: any): symbol | string | number {
545545
const symbolOrNumber =
546546
typeof type === 'object' && type !== null ? type.$$typeof : type;
547547

548548
return typeof symbolOrNumber === 'symbol'
549-
? // $FlowFixMe[incompatible-return] `toString()` doesn't match the type signature?
550-
symbolOrNumber.toString()
549+
? symbolOrNumber.toString()
551550
: symbolOrNumber;
552551
}
553552

0 commit comments

Comments
 (0)