首页 > 解决方案 > Calling typescript interface from commonJS function call

问题描述

I have this code sample in ts AuthorityProvider is an interface its implemented on the library like this

export interface AuthorityProvider {
     /** Get subset of `availableKeys` needed to meet authorities in `transaction` */
    getRequiredKeys: (args: AuthorityProviderArgs) => Promise<string[]>;
}

TScode

const authorityProvider: AuthorityProvider = {
  getRequiredKeys: (args: AuthorityProviderArgs): Promise<string[]> => {
    return Promise.resolve([accountPublicKey])
  },
}

I tried to recode this on CommonJS but no luck please advice this is my code

const authorityProvider = ( getRequiredKeys => {  
  return Promise.resolve([accountPublicKey]) 
})

标签: javascripttypescript

解决方案


推荐阅读