static _validate()

in packages/babel-plugin-fbt/src/translate/FbtSite.js [241:263]


  static _validate(entry: $ReadOnly<JSFBTMetaEntry>): void {
    const type = entry.type || null;
    const token = entry.token != null ? entry.token : null;
    const range = entry.range || null;
    if (type === null) {
      invariant(
        range !== null,
        'if no type is provided, this must be enum variation and thus range must be specified ',
      );
    } else {
      if (type === FbtVariationType.GENDER) {
        invariant(
          token !== null,
          'token should be specified for gender variation',
        );
      } else if (type === FbtVariationType.PRONOUN) {
        invariant(
          token === null,
          'token should not be specified for pronoun variation',
        );
      }
    }
  }