Migrating from an internal module to a Typescript external module

I started working on a project in which the front end is written in Typescript and using AngularJS 1.x. The project is quite large - ~ 500 Typescript files scattered all over the place in the solution of 92 C # / ASP.NET MVC projects.

All Typescript code is implemented using Typescript internal modules:

/// <reference path="../folder1/file1.ts" />
/// <reference path="../folder2/file2.ts" />

module Product.Module1 {
   export class Class1 {
      // ...
   }
}

The final goal is to switch to Angular 2. This may be a wrong assumption, but the first step in the migration path will be to refactor the current Typescript database from internal modules to external modules.

As you can imagine, a Typescript-based application with 500 files has a rather large dependency graph. Trying to convert the above sample to

class Class1 {
   // ...
}

export { Class1 };

, , , Class1. import { Class1 } from './samplefile' , .

:
 -   ?
 - , ? , Angular 1.x Angular 2.x /​​.

+4

Source: https://habr.com/ru/post/1672527/


All Articles