-
Notifications
You must be signed in to change notification settings - Fork 50
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
Comments
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. |
We should probably revisit this in the context of supporting ES6 versions of Dojo 2. |
This is sort of unactionable at the moment. There is no clear path of how we With the latest version of |
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 withIterators
. @devpaul pointed out that ReactiveX/RxJS (who likely have some of the most mature) have to "cheat" by typings things asany
.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.
The text was updated successfully, but these errors were encountered: