Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interoperating with large JS libraries is challenging #20189

Open
sethladd opened this issue Jul 24, 2014 · 3 comments
Open

Interoperating with large JS libraries is challenging #20189

sethladd opened this issue Jul 24, 2014 · 3 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. library-js P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-js-interop Issues that impact all js interop

Comments

@sethladd
Copy link
Contributor

It's "very painful" to work with large object-oriented JavaScript libraries with Dart. The dart:js library requires API access with a lot of quotes, strings, and brackets. Tooling becomes very difficult (did I misspell a word?), APIs become hard to read (new JsObject(context['google']['maps']['Map'], [...]);).

Would love a more toolable, scalable, developer-friendly JS interop mechanism that produces small and fast code.

@sethladd
Copy link
Contributor Author

Example of large JS libraries used by customers: CesiumJS, USNG

@DartBot
Copy link

DartBot commented Jul 25, 2014

This comment was originally written by @Emasoft


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:

  1. 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.

  2. 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.

  3. Autocompletition of the Dart Analyzer should support Typescript autocompletitions when editing Typescript files.

  4. 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.

  5. Typescript source files should be debugged, imported and exported to pub packages with yaml files the same way the Dart source files are.

  6. 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.

  7. 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.

@sethladd sethladd added Type-Defect area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-js labels Jul 25, 2014
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed triaged labels Mar 1, 2016
@denisoby
Copy link

I've tried to make my implementation of .d.ts -> dart2js annotations converter. Please, see https://github.com/denis-aes/DefinitelyTyped.dart

@sethladd FYI

@vsmenon vsmenon added the area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. label Jul 20, 2019
@joshualitt joshualitt added the web-js-interop Issues that impact all js interop label Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. library-js P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-js-interop Issues that impact all js interop
Projects
None yet
Development

No branches or pull requests

6 participants