Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

Improve shims #101

Merged
merged 28 commits into from
Jul 26, 2017
Merged

Improve shims #101

merged 28 commits into from
Jul 26, 2017

Conversation

kitsonk
Copy link
Member

@kitsonk kitsonk commented Jul 5, 2017

Type: feature

The following has been addressed in the PR:

  • There is a related issue
  • All code matches the style guide
  • Unit or Functional tests are included in the PR

Description:

This PR will improve our shims, allowing them to be better integrated with TypeScript types and be able to be reduced dramatically when optimized with dojo build and static has flags.

It is currently a work in progress. Promise and Map have been refactored.

src/Map.ts Outdated
values(): IterableIterator<V>;
}

let ShimMap: MapConstructor;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you let ShimMap: MapConstructor = global.Map;

Then replace if no es6-map and then just export default ShimMap;?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um... yes! DOH!

@kitsonk
Copy link
Member Author

kitsonk commented Jul 6, 2017

breaking change Several of our collection shims didn't include undefined returns, while the TypeScript libraries were updated. This does mean in many situations we were potentially dealing with an undefined value when retrieving a value from a collection, so it should improve code, but it will cause regressions in several areas.

@kitsonk
Copy link
Member Author

kitsonk commented Jul 6, 2017

breaking change it is also necessary to either target es2015 or beyond or include the lib.es2015.promise in the lib. This will eliminate the problem of duplicate Promise identifier errors though when targeting es2015 and beyond in downstream projects, so it feels worth it.

kitsonk added a commit to kitsonk/cli-build-webpack that referenced this pull request Jul 7, 2017
src/Promise.ts Outdated
* @borrows Promise#then as Promise#then
*/
export class Promise<T> implements Thenable<T> {
global.Promise = ShimPromise = <any> class Promise<T> implements Thenable<T> {
Copy link
Member

@agubler agubler Jul 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to cast to any here?

@kitsonk kitsonk merged commit cc0af58 into dojo:master Jul 26, 2017
kitsonk added a commit to dojo/core that referenced this pull request Jul 26, 2017
kitsonk added a commit to dojo/widgets that referenced this pull request Jul 26, 2017
kitsonk added a commit to dojo/widget-core that referenced this pull request Jul 26, 2017
kitsonk added a commit to kitsonk/cli-build-webpack that referenced this pull request Aug 1, 2017
@dylans dylans added this to the 2017.07 milestone Aug 9, 2017
kitsonk added a commit to kitsonk/cli-build-webpack that referenced this pull request Aug 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants