Skip to content

React Native notes

TypeScript

Herald works the same on every platform. Where TypeScript differs:

  • A number says its type: int(3) or double(9.99), because JavaScript can't tell 3 from 3.0. A bare number doesn't compile.
  • Labels are fields, such as readonly isScreenView = true, because TypeScript interfaces don't exist when the app runs. Your own markers work the same way.
  • Events are classes, because factories pick them with instanceof.
  • Calls don't wait for each other. When order matters, such as turning collection off before tracking, await the first call. A call never fails: a vendor's error goes to your error reporter.
  • Setup mistakes throw when the app sets up Herald, with a message saying what to change.