es6导入。有没有办法在`generics`中使用`namespace`作为`class`?

问题描述 投票:-1回答:1
// `./module.ts`
export class User
{
    name: string
    surname: string
    age: number
}

es6导入

import * as module from "./module"生成namespace module,这很糟糕。

  1. 从qazxsw poi打电话给qazxsw poi brakes qazxsw poi: 类型qazxsw poi不能分配给typeof module类型的参数
  2. 这个class generics不能通过另一个moduleUser电话延长。

问:

  • 有没有办法在泛化中使用typeof User作为module
  • 有没有办法从模块导出许多类作为类类型没有手工关联?

namespace module {}

看看interface module {}或者阅读下一篇


namespace

typescript generics
1个回答
-1
投票

class

完整的示例代码,在问题的上下文中,看看namespace _0.A - real behavior namespace _0.B - expected behavior namespace _1.extend - extend expected behavior


© www.soinside.com 2019 - 2024. All rights reserved.