Trying to modify my axios wrapper and can't figure out why I'm getting this typescript error...
type Headers = {
  Accept: string;
  'Content-Type': string;
  Authorization?: string;
}

export interface AxiosOptions {
  params?: any;
  data?: any;
  headers: Headers;
}

const axiosOptions: AxiosOptions = {
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
};

export const updateAxiosOptionsHeaders = (
    key: Pick<Headers, "Accept" | "Content-Type" | "Authorization">,
    value: string
  ): void => {
  axiosOptions.headers[key] = value;
}




Pick error "Type 'Pick' cannot be used as an index type."
This doesn't really meet the usage pattern of Pick. You just need keyof Headers for your case:
type Headers = {
  Accept: string;
  'Content-Type': string;
  Authorization?: string;
}

export interface AxiosOptions {
  params?: any;
  data?: any;
  headers: Headers;
}

const axiosOptions: AxiosOptions = {
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
};

export const updateAxiosOptionsHeaders = (
    key: keyof Headers,
    value: string
  ): void => {
  axiosOptions.headers[key] = value;
}

Playground link

Should you also have different value types in your object (which seems unlikely for a headers object), you can use a generic constraint:
export const updateAxiosOptionsHeaders = <K extends keyof Headers>(
    key: K,
    value: Headers[K]
  ): void => {
  axiosOptions.headers[key] = value;
}

