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

ES6 Typings #29

Closed
kitsonk opened this issue Apr 8, 2016 · 3 comments
Closed

ES6 Typings #29

kitsonk opened this issue Apr 8, 2016 · 3 comments

Comments

@kitsonk
Copy link
Member

kitsonk commented Apr 8, 2016

As discussed in #18, we have scenarios where when having ES6+ targetted code versus ES5 targetted code, the typings have to be different. Even with shimming the way we do, we run into issues when targetting ES6 (for example TypeScript complains when you aren't using the native Symbol when you target ES6) and it is difficult to deal with Iterators. @devpaul pointed out that ReactiveX/RxJS (who likely have some of the most mature) have to "cheat" by typings things as any.

We think Conditional Decorators Microsoft/TypeScript#3538 and Micro Targetting Microsoft/TypeScript#4692 will potentially provide us with the tooling to make it easier to generate ES6 code as well as generate the correct corresponding typings.

We should also check out how typings/typings will help manage these situations, to understand if different targeted versions of typings can be made available to be consumed.

@kitsonk kitsonk added this to the 2016.07 milestone Apr 8, 2016
@devpaul
Copy link
Member

devpaul commented Apr 29, 2016

We can accomplish this today without Conditional Decorators and Micro Targeting by externalizing all of our interfaces and making our types generic. For example with array.from

// in array.ts
from<T>(arrayLike: Arrayish, mapFunction?: MapCallback<T>, thisArg?: {}): ArrayLike<T>

// in array.es5.d.ts
declare type Arrayish = string | ArrayLike<T>;

// in array.es6.d.ts
declare type Arrayish = string | ArrayLike<T> | Iterable;

When compiling we would include *.d.ts and *.es5.d.ts typings when targeting es5 and *.d.ts and *.es6.d.ts when targeting an es6 build. This increases typing complexity the more platforms we target, but should be achievable within current constraints.

We will still need to solve providing ambient typings to the typings repo.

@kitsonk kitsonk modified the milestones: 2016.07, 2016.08 Aug 1, 2016
@kitsonk kitsonk removed this from the 2016.08 milestone Oct 4, 2016
@dylans
Copy link
Member

dylans commented Jan 12, 2017

We should probably revisit this in the context of supporting ES6 versions of Dojo 2.

@dylans dylans added this to the 2017.02 milestone Jan 12, 2017
@dylans dylans modified the milestones: 2017.03, 2017.02 Feb 19, 2017
@dylans dylans modified the milestones: 2017.04, 2017.03 Mar 25, 2017
@dylans dylans added the beta3 label Mar 25, 2017
@dylans dylans modified the milestones: 2017.06, 2017.04 Apr 8, 2017
@eheasley eheasley modified the milestones: 2017.06, 2017.07 Jun 6, 2017
@kitsonk
Copy link
Member Author

kitsonk commented Jul 27, 2017

This is sort of unactionable at the moment. There is no clear path of how we

With the latest version of @dojo/shim downstream projects can target easily in ES2015+ for the emit, but the Dojo 2 packages are still ES5. At the moment, I don't think there is really anything more we can easily do... the "build dojo 2 from source" use case might eventually be valid, but still the complexity isn't worth the squeeze. Long live the transpiler. Closing...

@kitsonk kitsonk closed this as completed Jul 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants