Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

chore: Fix type definitions #298

Closed
wants to merge 1 commit into from
Closed

chore: Fix type definitions #298

wants to merge 1 commit into from

Conversation

park9140
Copy link

Fixes exported type definitions so that you can import from typescript using import { Zone } from 'zone.js' and not have the compiler complain about it not being a module.

Resolves #297, still needs a resolution to access the correct ZoneSpec via import without declaring a module manually.

@PatrickJS
Copy link
Contributor

you could also add this snippet to the zone.ts file

// Ensure this is treated as a module.
declare module "zone.js" {}

@park9140
Copy link
Author

@gdi2290 I considered that. I just figured it was better to push the project toward a correct implementation, rather than the current clumsy mish mosh of ambient dependency, and external modules.

@PatrickJS
Copy link
Contributor

no worries, your version is correct and preferred 👍

@@ -1,3 +1,5 @@
import { Zone, ZoneSpec, Task, ZoneDelegate, HasTaskState } from '../zone';
Copy link
Contributor

Choose a reason for hiding this comment

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

We can not add this code here. If we do then Zones will be included in the async-test.js bundle as well as zone.js bundle.

Zone's is meant as a polyfil, and so it should be ambiently available.

@mhevery
Copy link
Contributor

mhevery commented Apr 8, 2016

Thanks for you hard work, but we can't accept this PR. The issue is that Zone needs to be treated as if it is part of platform. ie. it needs to have ambient definition. Your change makes it so that it must be imported explicitly.

@mhevery mhevery closed this Apr 8, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants