Why does Record.set only accept string or symbol keys and not number?

is there a reason effects Record.set is typed to accept only string or symbol for record keys?

export function useAppForm<T extends FieldValues = FieldValues>(args: UseAppFormArgs<T>) {
  const fields: FieldCollection<T> = reactive({});

  function register(name: keyof T) {
    return pipe(
      fields,
      Record.set(name, { // Argument of type 'string | number | symbol' is not assignable to parameter of type 'string | symbol'.
        active: false,
        dirty: false,
        error: null,
        name,
        pristine: false,
        touched: false,
      }),
      Record.get(name)
    );
  }

  return { register };
}


keyof T is resolving to string | number | symbol but keys in Record operations appear to only accept string | symbol. i can cast to a string just curious to know the decision behind omitting number...
Was this page helpful?