Skip to content

$Enum type declaration causes flow error  #22

@andrewtremblay-pear

Description

@andrewtremblay-pear

Bug

In previous versions of PushNotificationIOS, types were declared with $Keys

https://github.com/facebook/react-native/blob/76ff31616e0b569d775c7156d8bc211d09a65fe9/Libraries/PushNotificationIOS/PushNotificationIOS.js#L39

export type PushNotificationEventName = $Keys<{

However the same type in the react-native-community location seems to be using $Enum :
https://github.com/react-native-community/react-native-push-notification-ios/blame/56cae07e2a179ff5bd4ebb5df417f324f8eb17c3/js/index.js#L38

export type PushNotificationEventName = $Enum<{

This is causing a flow error when updating imports:

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/@react-native-community/push-notification-ios/js/index.js:38:41

Cannot resolve name $Enum.

     35│ /**
     36│  * An event emitted by PushNotificationIOS.
     37│  */
     38│ export type PushNotificationEventName = $Enum<{
     39│   /**
     40│    * Fired when a remote notification is received. The handler will be invoked
     41│    * with an instance of `PushNotificationIOS`.

Environment info

React native info output:

info
  React Native Environment Info:
    System:
      OS: macOS 10.14.6
      CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
      Memory: 159.62 MB / 32.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 8.11.3 - ~/.nvm/versions/node/v8.11.3/bin/node
      Yarn: 1.10.1 - ~/.nvm/versions/node/v8.11.3/bin/yarn
      npm: 5.6.0 - ~/.nvm/versions/node/v8.11.3/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
      Android SDK:
        API Levels: 14, 16, 19, 23, 24, 25, 26, 27, 28
        Build Tools: 19.1.0, 20.0.0, 21.1.2, 22.0.1, 23.0.1, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.2, 28.0.3, 29.0.0, 29.0.1
        System Images: android-22 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64
    IDEs:
      Android Studio: 3.4 AI-183.6156.11.34.5522156
      Xcode: 10.3/10G8 - /usr/bin/xcodebuild
    npmPackages:
      react: ^16.8.6 => 16.9.0
      react-native: 0.59.10 => 0.59.10
    npmGlobalPackages:
      create-react-native-app: 2.0.2
      react-native-cli: 2.0.1
      react-native-create-library: 3.1.2
      react-native-git-upgrade: 0.2.7

Library version: 0.59.10

Steps To Reproduce

  1. create a react-native-application with the following dependencies
    https://gist.github.com/andrewtremblay-pear/518218ac326f8433faa83b6aa110f30f

  2. npm run flow
    ...

Describe what you expected to happen:

  1. Flow checks to pass or $Enum to be recognized

Reproducible sample code

Sample code repo can be provided, not sure if this is just an obvious error on my part. Googling for $Enum provides no helpful results so I'm guessing it's an undocumented additional dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions