Skip to content

Commit

Permalink
通过 flow2typescript 构建的 ts 版源码
Browse files Browse the repository at this point in the history
success compile: /Users/yidafu/github/react/packages/scheduler/src/forks/SchedulerFeatureFlags.www.ts
success compile: /Users/yidafu/github/react/packages/scheduler/src/TracingSubscriptions.ts
Warning: Exact types can't be expressed in TypeScript (at ../../../../../react/packages/scheduler/src/Tracing.js: line 12, column 26). See microsoft/TypeScript#12936
success compile: /Users/yidafu/github/react/packages/scheduler/src/Tracing.ts
success compile: /Users/yidafu/github/react/packages/scheduler/src/SchedulerFeatureFlags.ts
success compile: /Users/yidafu/github/react/packages/react-is/src/ReactIs.ts
success compile: /Users/yidafu/github/react/packages/scheduler/src/Scheduler.ts
success compile: /Users/yidafu/github/react/packages/react/src/forks/ReactCurrentDispatcher.www.ts
success compile: /Users/yidafu/github/react/packages/react/src/forwardRef.ts
success compile: /Users/yidafu/github/react/packages/react/src/forks/ReactCurrentOwner.www.ts
success compile: /Users/yidafu/github/react/packages/react/src/memo.ts
success compile: /Users/yidafu/github/react/packages/react/src/React.ts
success compile: /Users/yidafu/github/react/packages/react/src/ReactContext.ts
success compile: /Users/yidafu/github/react/packages/react/src/ReactCreateRef.ts
success compile: /Users/yidafu/github/react/packages/react/src/ReactBaseClasses.ts
success compile: /Users/yidafu/github/react/packages/react/src/ReactChildren.ts
success compile: /Users/yidafu/github/react/packages/react/src/ReactCurrentDispatcher.ts
success compile: /Users/yidafu/github/react/packages/react/src/ReactCurrentOwner.ts
success compile: /Users/yidafu/github/react/packages/react/src/ReactDebugCurrentFrame.ts
success compile: /Users/yidafu/github/react/packages/react/src/ReactElement.ts
success compile: /Users/yidafu/github/react/packages/react/src/ReactElementValidator.ts
success compile: /Users/yidafu/github/react/packages/react/src/ReactHooks.ts
success compile: /Users/yidafu/github/react/packages/react/src/ReactLazy.ts
success compile: /Users/yidafu/github/react/packages/react/src/ReactNoopUpdateQueue.ts
success compile: /Users/yidafu/github/react/packages/react/src/ReactSharedInternals.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/DOMPropertyOperations.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/getActiveElement.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/inputValueTracking.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/getNodeForCharacterOffset.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/ReactDOMComponentTree.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/ReactDOMClientInjection.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/ReactDOMFB.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/ReactDOMInput.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/ReactDOMOption.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/ReactDOMSelect.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/ReactDOMSelection.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/ReactDOMTextarea.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/setInnerHTML.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/ReactInputSelection.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/setTextContent.ts
Warning: Opaque types can't be expressed in TypeScript (at ../../../../../react/packages/react-dom/src/client/ToStringValue.js: line 10, column 7). See microsoft/TypeScript#202
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/ToStringValue.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/validateDOMNesting.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/BeforeInputEventPlugin.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/ChangeEventPlugin.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/DOMEventPluginOrder.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/DOMTopLevelEventTypes.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/EnterLeaveEventPlugin.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/EventListener.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/forks/EventListener-www.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/FallbackCompositionState.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/getEventCharCode.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/getEventKey.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/getEventModifierState.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/getEventTarget.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/getVendorPrefixedEventName.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/isEventSupported.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/ReactBrowserEventEmitter.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/ReactDOMEventListener.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/SelectEventPlugin.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/SimpleEventPlugin.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/SyntheticClipboardEvent.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/SyntheticCompositionEvent.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/SyntheticAnimationEvent.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/SyntheticDragEvent.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/SyntheticFocusEvent.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/SyntheticInputEvent.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/SyntheticKeyboardEvent.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/SyntheticMouseEvent.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/SyntheticPointerEvent.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/SyntheticTouchEvent.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/SyntheticTransitionEvent.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/SyntheticWheelEvent.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/events/SyntheticUIEvent.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/fire/ReactFireHostConfig.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/server/DOMMarkupOperations.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/server/escapeTextForBrowser.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/server/quoteAttributeValueForBrowser.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/server/ReactDOMFizzServerBrowser.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/server/ReactDOMFizzServerFormatConfig.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/server/ReactDOMFizzServerNode.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/server/ReactDOMNodeStreamRenderer.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/server/ReactDOMServerBrowser.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/server/ReactDOMServerNode.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/server/ReactDOMStringRenderer.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/server/ReactPartialRendererContext.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/server/ReactPartialRendererHooks.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/server/ReactThreadIDAllocator.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/assertValidProps.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/checkReact.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/createMicrosoftUnsafeLocalFunction.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/CSSProperty.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/CSSPropertyOperations.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/CSSShorthandProperty.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/dangerousStyleValue.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/DOMNamespaces.ts
The following comments are not represented in leadingComments, trailingComments or innerComments of any node in the AST:
[
  {
    type: 'CommentLine',
    value: ' attributeNamespace',
    start: 6393,
    end: 6414,
    loc: SourceLocation { start: [Position], end: [Position] }
  },
  {
    type: 'CommentLine',
    value: ' attributeNamespace',
    start: 6850,
    end: 6871,
    loc: SourceLocation { start: [Position], end: [Position] }
  },
  {
    type: 'CommentLine',
    value: ' attributeNamespace',
    start: 7329,
    end: 7350,
    loc: SourceLocation { start: [Position], end: [Position] }
  },
  {
    type: 'CommentLine',
    value: ' attributeNamespace',
    start: 7900,
    end: 7921,
    loc: SourceLocation { start: [Position], end: [Position] }
  },
  {
    type: 'CommentLine',
    value: ' attributeNamespace',
    start: 8621,
    end: 8642,
    loc: SourceLocation { start: [Position], end: [Position] }
  },
  {
    type: 'CommentLine',
    value: ' attributeNamespace',
    start: 9275,
    end: 9296,
    loc: SourceLocation { start: [Position], end: [Position] }
  },
  {
    type: 'CommentLine',
    value: ' attributeNamespace',
    start: 9782,
    end: 9803,
    loc: SourceLocation { start: [Position], end: [Position] }
  },
  {
    type: 'CommentLine',
    value: ' attributeNamespace',
    start: 10233,
    end: 10254,
    loc: SourceLocation { start: [Position], end: [Position] }
  },
  {
    type: 'CommentLine',
    value: ' attributeNamespace',
    start: 10504,
    end: 10525,
    loc: SourceLocation { start: [Position], end: [Position] }
  },
  {
    type: 'CommentLine',
    value: ' attributeNamespace',
    start: 12777,
    end: 12798,
    loc: SourceLocation { start: [Position], end: [Position] }
  },
  {
    type: 'CommentLine',
    value: ' attributeNamespace',
    start: 14306,
    end: 14327,
    loc: SourceLocation { start: [Position], end: [Position] }
  }
]
Attempting to add them back into the AST
Successfully backfilled comments into the AST
Warning: Exact types can't be expressed in TypeScript (at ../../../../../react/packages/react-dom/src/shared/DOMProperty.js: line 47, column 27). See microsoft/TypeScript#12936
Warning: Contravariance can't be expressed in TypeScript (at ../../../../../react/packages/react-dom/src/shared/DOMProperty.js: line 48, column 2). See microsoft/TypeScript#1394
Warning: Contravariance can't be expressed in TypeScript (at ../../../../../react/packages/react-dom/src/shared/DOMProperty.js: line 49, column 2). See microsoft/TypeScript#1394
Warning: Contravariance can't be expressed in TypeScript (at ../../../../../react/packages/react-dom/src/shared/DOMProperty.js: line 50, column 2). See microsoft/TypeScript#1394
Warning: Contravariance can't be expressed in TypeScript (at ../../../../../react/packages/react-dom/src/shared/DOMProperty.js: line 51, column 2). See microsoft/TypeScript#1394
Warning: Contravariance can't be expressed in TypeScript (at ../../../../../react/packages/react-dom/src/shared/DOMProperty.js: line 52, column 2). See microsoft/TypeScript#1394
Warning: Contravariance can't be expressed in TypeScript (at ../../../../../react/packages/react-dom/src/shared/DOMProperty.js: line 53, column 2). See microsoft/TypeScript#1394
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/DOMProperty.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/HTMLNodeType.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/hyphenateStyleName.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/isCustomComponent.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/omittedCloseTags.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/possibleStandardNames.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/ReactControlledValuePropTypes.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/ReactDOMInvalidARIAHook.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/ReactDOMNullInputValuePropHook.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/ReactDOMUnknownPropertyHook.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/validAriaProperties.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/voidElementTags.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/shared/warnValidStyle.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/unstable-native-dependencies/ReactDOMUnstableNativeDependencies.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/forks/ReactFiberErrorDialog.native.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/forks/ReactFiberErrorDialog.www.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/forks/ReactFiberHostConfig.art.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/forks/ReactFiberHostConfig.dom-browser.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/forks/ReactFiberHostConfig.dom.ts
/Users/yidafu/github/react/packages/react-reconciler/src/forks/ReactFiberHostConfig.custom.js
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/forks/ReactFiberHostConfig.native.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/forks/ReactFiberHostConfig.test.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/forks/ReactFiberHostConfig.fabric.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/forks/ReactFiberHostConfig.fire.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/maxSigned31BitInt.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactCapturedValue.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactCurrentFiber.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactDebugFiberPerf.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberContext.ts
/Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberDevToolsHook.js
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberErrorDialog.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberErrorLogger.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberExpirationTime.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberHostConfig.ts
/Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberHostContext.js
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberHydrationContext.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberInstrumentation.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberLazyComponent.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberNewContext.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberPendingPriority.ts
Warning: Exact types can't be expressed in TypeScript (at ../../../../../react/packages/react-reconciler/src/ReactFiberReconciler.js: line 74, column 22). See microsoft/TypeScript#12936
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberReconciler.ts
Warning: Exact types can't be expressed in TypeScript (at ../../../../../react/packages/react-reconciler/src/ReactFiberRoot.js: line 32, column 31). See microsoft/TypeScript#12936
Warning: Contravariance can't be expressed in TypeScript (at ../../../../../react/packages/react-reconciler/src/ReactFiberRoot.js: line 75, column 2). See microsoft/TypeScript#1394
Warning: Exact types can't be expressed in TypeScript (at ../../../../../react/packages/react-reconciler/src/ReactFiberRoot.js: line 92, column 40). See microsoft/TypeScript#12936
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberRoot.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberStack.ts
Warning: Exact types can't be expressed in TypeScript (at ../../../../../react/packages/react-reconciler/src/ReactFiberSuspenseComponent.js: line 13, column 28). See microsoft/TypeScript#12936
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberSuspenseComponent.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberTreeReflection.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactHookEffectTags.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactProfilerTimer.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactStrictModeWarnings.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactTypeOfMode.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/ReactDOM.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/ReactDOMHostConfig.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/fire/ReactFire.ts
/Users/yidafu/github/react/packages/react-dom/src/test-utils/ReactTestUtils.js
Warning: Exact types can't be expressed in TypeScript (at ../../../../../react/packages/react-reconciler/src/ReactFiber.js: line 86, column 20). See microsoft/TypeScript#12936
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiber.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberCompleteWork.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberUnwindWork.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactUpdateQueue.ts
success compile: /Users/yidafu/github/react/packages/react-dom/src/client/ReactDOMComponent.ts
Warning: Exact types can't be expressed in TypeScript (at ../../../../../react/packages/react-dom/src/server/ReactPartialRenderer.js: line 403, column 3). See microsoft/TypeScript#12936
success compile: /Users/yidafu/github/react/packages/react-dom/src/server/ReactPartialRenderer.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactChildFiber.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberClassComponent.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberCommitWork.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberHooks.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberBeginWork.ts
success compile: /Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberScheduler.ts
➜  script-tools git:(master) ✗ node ./react-trans-flow-2-ts
/Users/yidafu/github/react/packages/react-reconciler/src/forks/ReactFiberHostConfig.custom.js
/Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberHostContext.js
/Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberDevToolsHook.js
/Users/yidafu/github/react/packages/react-dom/src/test-utils/ReactTestUtils.js
➜  script-tools git:(master) ✗ node ./react-trans-flow-2-ts
/Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberDevToolsHook.js
/Users/yidafu/github/react/packages/react-reconciler/src/forks/ReactFiberHostConfig.custom.js
/Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberHostContext.js
/Users/yidafu/github/react/packages/react-dom/src/test-utils/ReactTestUtils.js
➜  script-tools git:(master) ✗ node ./react-trans-flow-2-ts
success compile: /Users/yidafu/github/react/packages/shared/describeComponentFrame.ts
success compile: /Users/yidafu/github/react/packages/shared/ExecutionEnvironment.ts
success compile: /Users/yidafu/github/react/packages/shared/forks/invariant.www.ts
success compile: /Users/yidafu/github/react/packages/shared/forks/lowPriorityWarning.www.ts
success compile: /Users/yidafu/github/react/packages/shared/forks/invokeGuardedCallbackImpl.www.ts
success compile: /Users/yidafu/github/react/packages/shared/forks/object-assign.umd.ts
success compile: /Users/yidafu/github/react/packages/shared/forks/ReactFeatureFlags.native-fb.ts
success compile: /Users/yidafu/github/react/packages/shared/forks/ReactFeatureFlags.native-oss.ts
success compile: /Users/yidafu/github/react/packages/shared/forks/ReactFeatureFlags.persistent.ts
success compile: /Users/yidafu/github/react/packages/shared/forks/ReactFeatureFlags.readonly.ts
success compile: /Users/yidafu/github/react/packages/shared/forks/ReactFeatureFlags.test-renderer.ts
success compile: /Users/yidafu/github/react/packages/shared/forks/ReactFeatureFlags.test-renderer.www.ts
success compile: /Users/yidafu/github/react/packages/shared/forks/ReactFeatureFlags.www.ts
success compile: /Users/yidafu/github/react/packages/shared/forks/Scheduler.umd.ts
success compile: /Users/yidafu/github/react/packages/shared/forks/SchedulerTracing.umd.ts
success compile: /Users/yidafu/github/react/packages/shared/forks/warningWithoutStack.www.ts
success compile: /Users/yidafu/github/react/packages/shared/HostConfigWithNoHydration.ts
success compile: /Users/yidafu/github/react/packages/shared/getComponentName.ts
success compile: /Users/yidafu/github/react/packages/shared/HostConfigWithNoMutation.ts
success compile: /Users/yidafu/github/react/packages/shared/HostConfigWithNoPersistence.ts
success compile: /Users/yidafu/github/react/packages/shared/invariant.ts
success compile: /Users/yidafu/github/react/packages/shared/invokeGuardedCallbackImpl.ts
success compile: /Users/yidafu/github/react/packages/shared/isTextInputElement.ts
success compile: /Users/yidafu/github/react/packages/shared/isValidElementType.ts
success compile: /Users/yidafu/github/react/packages/shared/lowPriorityWarning.ts
success compile: /Users/yidafu/github/react/packages/shared/objectIs.ts
success compile: /Users/yidafu/github/react/packages/shared/ReactElementType.ts
success compile: /Users/yidafu/github/react/packages/shared/ReactErrorUtils.ts
success compile: /Users/yidafu/github/react/packages/shared/ReactFeatureFlags.ts
success compile: /Users/yidafu/github/react/packages/shared/ReactInstanceMap.ts
success compile: /Users/yidafu/github/react/packages/shared/ReactLazyComponent.ts
success compile: /Users/yidafu/github/react/packages/shared/ReactPortal.ts
success compile: /Users/yidafu/github/react/packages/shared/reactProdInvariant.ts
success compile: /Users/yidafu/github/react/packages/shared/ReactSharedInternals.ts
success compile: /Users/yidafu/github/react/packages/shared/ReactSymbols.ts
success compile: /Users/yidafu/github/react/packages/shared/ReactTreeTraversal.ts
success compile: /Users/yidafu/github/react/packages/shared/ReactSideEffectTags.ts
Warning: Exact types can't be expressed in TypeScript (at ../../../../../react/packages/shared/ReactTypes.js: line 78, column 24). See microsoft/TypeScript#12936
success compile: /Users/yidafu/github/react/packages/shared/ReactTypes.ts
success compile: /Users/yidafu/github/react/packages/shared/ReactVersion.ts
success compile: /Users/yidafu/github/react/packages/shared/shallowEqual.ts
success compile: /Users/yidafu/github/react/packages/shared/ReactWorkTags.ts
success compile: /Users/yidafu/github/react/packages/shared/warning.ts
success compile: /Users/yidafu/github/react/packages/shared/warningWithoutStack.ts
/Users/yidafu/github/react/packages/react-reconciler/src/forks/ReactFiberHostConfig.custom.js
/Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberHostContext.js
/Users/yidafu/github/react/packages/react-reconciler/src/ReactFiberDevToolsHook.js
/Users/yidafu/github/react/packages/react-dom/src/test-utils/ReactTestUtils.js
  • Loading branch information
yidafu authored and yidafu committed Aug 8, 2020
1 parent 487f4bf commit cdd23a9
Show file tree
Hide file tree
Showing 238 changed files with 14,516 additions and 14,519 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@
*/

import {
getPropertyInfo,
shouldIgnoreAttribute,
shouldRemoveAttribute,
isAttributeNameSafe,
BOOLEAN,
OVERLOADED_BOOLEAN,
} from '../shared/DOMProperty';
getPropertyInfo,
shouldIgnoreAttribute,
shouldRemoveAttribute,
isAttributeNameSafe,
BOOLEAN,
OVERLOADED_BOOLEAN } from
'../shared/DOMProperty';

import type {PropertyInfo} from '../shared/DOMProperty';
import { PropertyInfo } from '../shared/DOMProperty';

/**
* Get the value for a property on a node. Only used in DEV for SSR validation.
* The "expected" argument is used as a hint of what the expected value is.
* Some properties have multiple equivalent values.
*/
* Get the value for a property on a node. Only used in DEV for SSR validation.
* The "expected" argument is used as a hint of what the expected value is.
* Some properties have multiple equivalent values.
*/
export function getValueForProperty(
node: Element,
name: string,
expected: mixed,
propertyInfo: PropertyInfo,
): mixed {
node: Element,
name: string,
expected: unknown,
propertyInfo: PropertyInfo)
: unknown {
if (__DEV__) {
if (propertyInfo.mustUseProperty) {
const {propertyName} = propertyInfo;
return (node: any)[propertyName];
const { propertyName } = propertyInfo;
return (node as any)[propertyName];
} else {
const attributeName = propertyInfo.attributeName;

Expand All @@ -47,7 +47,7 @@ export function getValueForProperty(
if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
return value;
}
if (value === '' + (expected: any)) {
if (value === '' + (expected as any)) {
return expected;
}
return value;
Expand All @@ -72,7 +72,7 @@ export function getValueForProperty(

if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
return stringValue === null ? expected : stringValue;
} else if (stringValue === '' + (expected: any)) {
} else if (stringValue === '' + (expected as any)) {
return expected;
} else {
return stringValue;
Expand All @@ -82,15 +82,15 @@ export function getValueForProperty(
}

/**
* Get the value for a attribute on a node. Only used in DEV for SSR validation.
* The third argument is used as a hint of what the expected value is. Some
* attributes have multiple equivalent values.
*/
* Get the value for a attribute on a node. Only used in DEV for SSR validation.
* The third argument is used as a hint of what the expected value is. Some
* attributes have multiple equivalent values.
*/
export function getValueForAttribute(
node: Element,
name: string,
expected: mixed,
): mixed {
node: Element,
name: string,
expected: unknown)
: unknown {
if (__DEV__) {
if (!isAttributeNameSafe(name)) {
return;
Expand All @@ -99,26 +99,26 @@ export function getValueForAttribute(
return expected === undefined ? undefined : null;
}
const value = node.getAttribute(name);
if (value === '' + (expected: any)) {
if (value === '' + (expected as any)) {
return expected;
}
return value;
}
}

/**
* Sets the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
* @param {*} value
*/
* Sets the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
* @param {*} value
*/
export function setValueForProperty(
node: Element,
name: string,
value: mixed,
isCustomComponentTag: boolean,
) {
node: Element,
name: string,
value: unknown,
isCustomComponentTag: boolean)
{
const propertyInfo = getPropertyInfo(name);
if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
return;
Expand All @@ -133,37 +133,37 @@ export function setValueForProperty(
if (value === null) {
node.removeAttribute(attributeName);
} else {
node.setAttribute(attributeName, '' + (value: any));
node.setAttribute(attributeName, '' + (value as any));
}
}
return;
}
const {mustUseProperty} = propertyInfo;
const { mustUseProperty } = propertyInfo;
if (mustUseProperty) {
const {propertyName} = propertyInfo;
const { propertyName } = propertyInfo;
if (value === null) {
const {type} = propertyInfo;
(node: any)[propertyName] = type === BOOLEAN ? false : '';
const { type } = propertyInfo;
(node as any)[propertyName] = type === BOOLEAN ? false : '';
} else {
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
(node: any)[propertyName] = value;
(node as any)[propertyName] = value;
}
return;
}
// The rest are treated as attributes with special cases.
const {attributeName, attributeNamespace} = propertyInfo;
const { attributeName, attributeNamespace } = propertyInfo;
if (value === null) {
node.removeAttribute(attributeName);
} else {
const {type} = propertyInfo;
const { type } = propertyInfo;
let attributeValue;
if (type === BOOLEAN || (type === OVERLOADED_BOOLEAN && value === true)) {
if (type === BOOLEAN || type === OVERLOADED_BOOLEAN && value === true) {
attributeValue = '';
} else {
// `setAttribute` with objects becomes only `[object]` in IE8/9,
// ('' + value) makes it output the correct toString()-value.
attributeValue = '' + (value: any);
attributeValue = '' + (value as any);
}
if (attributeNamespace) {
node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
Expand Down
Loading

0 comments on commit cdd23a9

Please sign in to comment.