How to export a function type?

前端 未结 1 1225
庸人自扰
庸人自扰 2021-02-14 06:22

This is how I export and import typescript interface for objects. Everything works just fine. Giving this as an example of what I\'m trying to achieve, but with functions.

相关标签:
1条回答
  • 2021-02-14 07:07

    This is how it's done:

    Module 1

    export type myFunction = (arg: string) => void
    

    Module 2

    import {myFunction} from './module1';
    
    let someFunction: myFunction; 
    
    0 讨论(0)
提交回复
热议问题