I'm trying to augment the types in the iam-policies npm package.
Specifically, I am attempting to augment the ConditionKey type, or anything that will get me to the result that I want.
Here's what the types file for the package look like:
export declare type ConditionKey = string | number | boolean;
...
declare type Resolver = (data: ConditionKey, expected: ConditionKey) => boolean;
export interface ConditionResolver {
[key: string]: Resolver;
}
export interface Context {
[key: string]: ConditionKey | Context | string[] | number[];
}
Here's what my file iam-policies.d.ts looks like:
import { conditionResolvers } from './conditions';
import { ConditionMap, ConditionKey } from 'iam-policies/dist/src/types';
declare module 'iam-policies/dist/src/types' {
type Resolver = (data: any, expected: any) => boolean;
type ConditionResolver = {
[key in keyof typeof conditionResolvers]?: Resolver
}
export interface Context {
[key: string]: any;
}
}
I have errors such as "Duplicate Identifier 'ConditionBlock'", "Duplicate string index signature." and others that indicate data and expected in my conditionResolvers can't be of type Date. My tsconfig file is the same as the one found on the NestJS Typescript Starter.
What I want is to be able to augment the type of the parameters in the Resolver object and the type of. The ConditionResolver is a collection of functions.