Can't export constant in Typescript

后端 未结 1 716
夕颜
夕颜 2021-02-06 22:16

Can someone help me please

I have 2 files main.ts and hi.ts

hi.ts:

export const hello = \"dd\";

main.ts:

import         


        
相关标签:
1条回答
  • 2021-02-06 22:21

    My answer refers to TypeScript 2+.

    // 1.ts
    export const AdminUser = { ... }
    
    // index.ts
    import * as users from './docs/users/admin';
    var adminUser = users.AdminUser;
    

    The only difference between your code and mine is the * operator in the import statement.

    0 讨论(0)
提交回复
热议问题