polymer-dart / dart2ts

An experimental dart to typescript transpiler
https://www.dart-polymer.com/dart2ts
60 stars 7 forks source link

I have to fix some things before I was able to compile and run the test sample #1

Closed ajsergeev closed 7 years ago

ajsergeev commented 7 years ago

Hi, basically: 1) I have to get rid of Function in dart code, replace it by typedef (I'm using dart SDK 1.22 ) 2) I have to add ts libs to tsconfig.json "experimentalDecorators" :true,

Very interesting project, thanks!!!

ajsergeev commented 7 years ago

changes.txt

ajsergeev commented 7 years ago

With analizer I was able to make it work only like this: typedef dynamic FLATTER_WITH_DT(Y); Iterable flattenWith<X, Y>(Iterable x, FLATTER_WITH_DT extract) sync* { and X runWithContext(AnalysisContext ctx, Function body) => runZoned(() => body() as X, zoneValues: {'dart2ts.analysisContext':ctx});

dam0vm3nt commented 7 years ago

Thanks. Yes Function style is not yet supported. Now I'm a bit stuck because I had to find a convenient way to support the core lib.

dam0vm3nt commented 7 years ago

please can you send me a PR for the changes you submitted ? I will definitively try to merge them.

ajsergeev commented 7 years ago

Hi, could you, please, allow me to push a branch so I can push my changes and do Pull-Request? Then you will be able to filter-out what you need and merge changes. Thanks!

dam0vm3nt commented 7 years ago

You just have to fork the repo. Push your changes on your own fork then use GitHub to create and send me the push request. That's how usually works with GitHub projects

ajsergeev commented 7 years ago

Done

dam0vm3nt commented 7 years ago

Merged. I've changed one thing where you patched the code for windows, but could not test it if it doesn't break. Can you check it for me please ? Tnx again!

ajsergeev commented 7 years ago

Hi, tested, now all imports are broken for me because they all use platform separator ('\'): 1) sample1.dart has imports: import 'sample2.dart' as xy; import 'package:js/js.dart'; import 'sample3.dart'; import 'dart:html'; import 'model/model.dart' as DGM; // just lib in nested folder with simple classes 2) When compiled to ts, I've got in sample1.ts import as lib1 from ".\sample3"; import as lib2 from ".\sample2"; import as core from "dart_sdk/core"; import as lib4 from ".\model\model"; 3) When running webpack I've got a message it can't find that files. This is working fine: import as lib1 from "./sample3"; import as lib2 from "./sample2"; import as core from "dart_sdk/core"; import as lib4 from "./model/model"; Let me know if you need more info, I'll make a short video that demonstraits the issue. Thanks!

dam0vm3nt commented 7 years ago

ouch! Ok, I've restored your path separator replacement trick, can you test it now ?

ajsergeev commented 7 years ago

It works good now for me. Thanks!