Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface IInterface {
- Method1: (param1: any) => any;
- Method2: (param2: string[]) => any;
- }
- const keys = Reflect.ownKeys({} as IInterface);
- let obj = {};
- for (let key in keys) {
- obj[key] = (...params) => {
- console.log(`Chamou a função ${key}!`);
- return params.length > 0 ? params[0] : false;
- };
- }
- let obj2: IInterface = obj as IInterface; // Aqui eu teria a instancia de IInterface
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement