mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
fix: incorrect type in getTypeSymbol (#32825)
`getTypeSymbol` also returns string
This commit is contained in:
parent
6a7650c75c
commit
a9d63f3f97
|
|
@ -248,7 +248,7 @@ function createVirtualInstance(
|
|||
type DevToolsInstance = FiberInstance | VirtualInstance | FilteredFiberInstance;
|
||||
|
||||
type getDisplayNameForFiberType = (fiber: Fiber) => string | null;
|
||||
type getTypeSymbolType = (type: any) => symbol | number;
|
||||
type getTypeSymbolType = (type: any) => symbol | string | number;
|
||||
|
||||
type ReactPriorityLevelsType = {
|
||||
ImmediatePriority: number,
|
||||
|
|
@ -541,13 +541,12 @@ export function getInternalReactConstants(version: string): {
|
|||
// End of copied code.
|
||||
// **********************************************************
|
||||
|
||||
function getTypeSymbol(type: any): symbol | number {
|
||||
function getTypeSymbol(type: any): symbol | string | number {
|
||||
const symbolOrNumber =
|
||||
typeof type === 'object' && type !== null ? type.$$typeof : type;
|
||||
|
||||
return typeof symbolOrNumber === 'symbol'
|
||||
? // $FlowFixMe[incompatible-return] `toString()` doesn't match the type signature?
|
||||
symbolOrNumber.toString()
|
||||
? symbolOrNumber.toString()
|
||||
: symbolOrNumber;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user