This is just TS working as intended, there is very little use-case where the default behavior of iterating over a String's prototypical keys are actually what someone wants to do, hence why this doesn't work. More often than not this type of accessing the keys of string Object is used in intersections to "brand" a string, rather than actually access it's prototype methods
type test = getActions<string & {brand: 'Brand'}> extends {brand: 'Brand'} ? true : false
// ^? `type test = true`
Looks like you are trying to type the experimental .at
You'll have to jump through some hoops but here is where I sourced my answer from: How to extend String Prototype and use it next, in Typescript?
Extending the modules in this way can only be done in a special declaration > .d.ts files*.
//in a .d.ts file:
declare global {
interface String {
at(a: number) : string;
}
}
This assumes you implement or polyfill the at yourself. Otherwise you'll have to change the library tsconfig option to es2022 or later to support .at