The function's second argument type is determined by the string value of the first argument. Here is an example of what I am trying to achieve:
async action (name: 'create', args: { table: string, object: StorageObject }): Promise<StorageObject>;
async action (name: 'createOrUpdate', args: { table: string, query: StorageQuery, object: StorageObject }): Promise<Array<StorageObject>>;
async action (name: 'read', args: { table: string, query: StorageQuery }): Promise<Array<StorageObject>>;
async action (name: 'update', args: { table: string, query: StorageQuery, object: StorageObject }): Promise<Array<StorageObject>>;
async action (name: 'delete', args: { table: string, query: StorageQuery }): Promise<Array<StorageObject>> {
...
}
However, I am currently facing this error message:
TS2394: This overload signature is not compatible with its implementation signature.