打字稿中的局部类

Pri*_*ati 6 partial-classes typescript

files.ts

export class ServiceUrls {
 static baseUrl: string = 'http://localhost:52949/V1/';
    static baseImageUrl: string = 'http://localhost:52949/';
}
Run Code Online (Sandbox Code Playgroud)

filess1.ts

extends interface  ServiceUrls{
 static baseUrl: string = 'http://localhost:52949/V1/';
    static baseImageUrl: string = 'http://localhost:52949/';
}
Run Code Online (Sandbox Code Playgroud)

如何在打字稿中实现部分类。我应该如何提供相同类的引用以使其像部分类一样工作。如果我在files1.ts中提供相同的类名称,则它会给出错误声明或预期的语句。

Mus*_*fah 2

我创建并使用@partial装饰器充当简化的语法,可以帮助将单个类的功能划分为多个类文件...... https://github.com/mustafah/partials