-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
This issue was originally filed by @Emasoft
I post this as a separate proposal. The issue arised first in response to 20189 ( https://code.google.com/p/dart/issues/detail?id=20189 ).
PROBLEM: Interoperating with large JS libraries from Dart is challenging and painful. Many js libraries use scripts like TypeScript or CoffeScript to help improve type checking and usability. Dart is not able to understand those scripts files, making very difficult to migrate projects to Dart and making the transition without wasting to much time.
SOLUTION: Dart should support TypeScript for interoperability. This would allow an easier migration from the .Net ecosystem to Dart. It would allow the users to immediatly include and reuse their TypeScript libraries in Dart projects without wasting years of work. Supporting CoffeScript should also be very important, many very important libraries are written in CoffeScript todays.
To do a proper support of Typescript the following requisites have to be meet:
-
User should just "drag&drop" a Typescript library in the DartEditor and it should automatically recognize it and make it works as a interop package. No configuration necessary.
-
Typescript types and classes should be recognized when called from Dart code and included in the static type checking analysis at compile time. The errors should be marked on the Typescript source, not on the derived javascript code.
-
Autocompletition of the Dart Analyzer should support Typescript autocompletitions when editing Typescript files.
-
Interop syntax should be completely automated and hidden to the user. API access from Dart to Typescript and from Typescript to Dart should not require to write or regenerate additional code. Typescript sources should be modified at any time without being forced to modify/update the Dart code that import them.
-
Typescript source files should be debugged, imported and exported to pub packages with yaml files the same way the Dart source files are.
-
When called from Dart sources, all autocompletition, function declarations and auto-discovery informations of TypeScript analyzer should be still available and integrated with the Dart Analyzer. It should be possible to choose from an autocompletition list and call any class, variable or function availables in the imported Typescript library.
-
Static type checking should be applied to ensure that the correct types are passed as arguments to (or from) the TypeScript libraries.
The same requisites should be meet in adding CoffeeScript support.
Dart should not only be able to "eat" the javascript world, it should also be able to absorb the huge CoffeeScript and TypeScript ecosystem, because almost all modern web projects are made with a mix of these.